findElement 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/findElement.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 702a657e840e5a6158112c5ec8075a508e81b925b4f16e5c3dc375363a6a1c8c
|
4
|
+
data.tar.gz: 04240be6774d722c81be34fd3d08bf5bd82b7ebd5086304cd0aa81481849813a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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]
|
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
|
+
|