findElement 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/findElement.rb +10 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae818b9e319cc4169568c9ca96d60910932c29633183b4e350f47d77bb5d8342
4
- data.tar.gz: b6eed16b33aac70cd001b2e211436cd80ac1e0d54e06031497a8ac6f0bff76d3
3
+ metadata.gz: 702a657e840e5a6158112c5ec8075a508e81b925b4f16e5c3dc375363a6a1c8c
4
+ data.tar.gz: 04240be6774d722c81be34fd3d08bf5bd82b7ebd5086304cd0aa81481849813a
5
5
  SHA512:
6
- metadata.gz: 9c58e8d12729f90345dbfcda523e90bfcde544a3ebd2937c6241303ab722c54c021f3716ae6e1a3d50e08131966e985a6f5dc9c7b7b62c4df088f748f2c3c632
7
- data.tar.gz: f422f2e65bcd36224de7bb7067d8d489c1656314a168c3f69710faf91de4ae60459318a5ba04ee23366ea0c7a4ccf50b3d2e58f409921fe2c34834853eb2128a
6
+ metadata.gz: 2c969942f71dac5bad8eb51a75a4967d2539747c12ce7b3c45320600b002717d4a907dc7c048827b66540071a115affa6e35604b9c32e2446ee893948ab377d3
7
+ data.tar.gz: 41983fdfc7cc97fb1a6a183b5224b11512c0da58e2bf4f498a2a732daf922e366240a38e9d1fac45c28e31caef6440a4ab54c03f1b94d76e212f7a85c8143d67
data/lib/findElement.rb CHANGED
@@ -28,10 +28,16 @@ findElement("adv-spinner loadingSpinner").text ==> picture
28
28
 
29
29
  def findElement text
30
30
 
31
- if text[0]== '/'
31
+ if text[0] == '/'
32
32
 
33
33
  return find(:xpath, text)
34
34
 
35
+ elsif text.include? "#" or text.include? "[" or text.include? "."
36
+ begin
37
+ return find(text)
38
+ rescue
39
+ $!
40
+ end
35
41
  else
36
42
 
37
43
  begin
@@ -40,10 +46,10 @@ def findElement text
40
46
  end
41
47
  rescue
42
48
  soruce = page.html
43
- cond = soruce.split(text)
49
+ cond = soruce.split(">" + text + "<")
44
50
  if cond.count == 2
45
51
  tag = cond[0].split("<").last
46
- tag = tag.split[0].delete(">")
52
+ tag = tag.split[0]
47
53
 
48
54
  if cond[0][cond[0].length - 1] == '"'
49
55
  attr = cond[0].split('<').last
@@ -78,3 +84,4 @@ def findElement text
78
84
 
79
85
  end
80
86
  end
87
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: findElement
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bünyamin orhan