gridium 1.1.13 → 1.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/element.rb +3 -1
- data/lib/page.rb +14 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb7127799f6a1c83d18a5a139f7b84f9d54f7844
|
4
|
+
data.tar.gz: 9af4c6ec7a7ebd639158cd076cb9f7d55326abff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20f987944c09a29fa4ce3d58feb17c2415a4bcf3d0fee50b3823ab4f06c3b8b084033b68be4215779089e4822de734dc968bf98ed88db8a0d1dab9f2fc0c2b6e
|
7
|
+
data.tar.gz: 0f3de5442e613dfb7955f4562b10ffa9fc22bb0745aa978998674f4df4a387fd8cbf6402f6615e2d5ce3dd2b0325f36fcfb63de7ffdb921acde08e47ae36f1b2
|
data/lib/element.rb
CHANGED
@@ -23,6 +23,8 @@ class Element
|
|
23
23
|
|
24
24
|
#how long to wait between clearing an input and sending keys to it
|
25
25
|
@text_padding_time = 0.15
|
26
|
+
|
27
|
+
@default_timeout = Gridium.config.element_timeout
|
26
28
|
end
|
27
29
|
|
28
30
|
def to_s
|
@@ -30,7 +32,7 @@ class Element
|
|
30
32
|
end
|
31
33
|
|
32
34
|
def element(opts = {})
|
33
|
-
timeout = opts[:timeout].nil? ?
|
35
|
+
timeout = opts[:timeout].nil? ? @default_timeout : opts[:timeout]
|
34
36
|
|
35
37
|
if stale?
|
36
38
|
wait = Selenium::WebDriver::Wait.new :timeout => timeout, :interval => 1
|
data/lib/page.rb
CHANGED
@@ -48,17 +48,23 @@ module Gridium
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
def self.has_text?(text, opts = {})
|
53
|
+
has_flash?(text, opts)
|
53
54
|
end
|
54
55
|
|
55
|
-
def self.has_flash?(text)
|
56
|
-
|
56
|
+
def self.has_flash?(text, opts = {})
|
57
|
+
timeout = opts[:timeout] || 5
|
58
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
|
57
59
|
begin
|
58
|
-
|
60
|
+
if opts[:visible]
|
61
|
+
element = wait.until { Element.new("Finding text '#{text}'", :xpath, "//*[text()='#{text}']").displayed? }
|
62
|
+
else
|
63
|
+
element = wait.until { Driver.html.include? text }
|
64
|
+
end
|
59
65
|
rescue Exception => exception
|
60
|
-
Log.debug("[GRIDIUM::Page]
|
61
|
-
Log.warn("[GRIDIUM::Page] Could not find the
|
66
|
+
Log.debug("[GRIDIUM::Page] exception was rescued: #{exception}")
|
67
|
+
Log.warn("[GRIDIUM::Page] Could not find the text '#{text}'!")
|
62
68
|
end
|
63
69
|
|
64
70
|
if element
|
@@ -122,7 +128,7 @@ module Gridium
|
|
122
128
|
end
|
123
129
|
|
124
130
|
def click_on(text)
|
125
|
-
Element.new("Clicking #{text}", :xpath, "//*[text()='#{text}'
|
131
|
+
Element.new("Clicking #{text}", :xpath, "//*[text()='#{text}']").click
|
126
132
|
end
|
127
133
|
|
128
134
|
# Click the link on the page
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gridium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Urban
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|