gridium 1.1.15 → 1.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/element_extensions.rb +38 -33
- data/lib/page.rb +1 -1
- 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: c3cd34ee0c8012768432f48c83e1ad9d690f3ac7
|
4
|
+
data.tar.gz: eaa3429b997c786c47d9080e8ce0c249e6480987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 054c8e990bc956d6e99041835edf9fb7c1da9fe952bff759afe4993a67634dc4b0f5478a042ccdd6d2dd8658abfff92171af27d794ab3fd9427f752094e7a0f4
|
7
|
+
data.tar.gz: e48f724a66786952f620a2e7aae6a0db5f8cd9ff2db6c830c22254a4c3466656a653a8d76df66d8161b2044a828e54be67ad4c6921605667c2a0f254580ac80e
|
data/lib/element_extensions.rb
CHANGED
@@ -1,44 +1,49 @@
|
|
1
1
|
include Gridium
|
2
2
|
|
3
3
|
class Gridium::ElementExtensions
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
class << self
|
5
|
+
def highlight(element)
|
6
|
+
Log.debug("[GRIDIUM::ElementExtensions] Highlighting element...")
|
7
|
+
original_border = Driver.execute_script("return arguments[0].style.border", element.element)
|
8
|
+
original_background = Driver.execute_script("return arguments[0].style.backgroundColor", element.element)
|
9
|
+
Driver.execute_script("arguments[0].style.border='3px solid lime'; return;", element.element)
|
10
|
+
Driver.execute_script("arguments[0].style.backgroundColor='lime'; return;", element.element)
|
11
|
+
sleep (Gridium.config.highlight_duration)
|
12
|
+
Driver.execute_script("arguments[0].style.border='" + original_border + "'; return;", element.element)
|
13
|
+
Driver.execute_script("arguments[0].style.backgroundColor='" + original_background + "'; return;", element.element)
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def scroll_to(element)
|
17
|
+
Log.debug("[GRIDIUM::ElementExtensions] Scrolling element into view...")
|
18
|
+
Driver.execute_script("arguments[0].scrollIntoView(); return;", element.element)
|
19
|
+
sleep 1
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
def hover_away(element)
|
23
|
+
Driver.execute_script("var evObj = document.createEvent('MouseEvents'); evObj.initMouseEvent(\"mouseout\",true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); arguments[0].dispatchEvent(evObj);", element.element)
|
24
|
+
sleep 1
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
#
|
28
|
+
# Mouse over the requested element at coordinate (Default x:0, y:0)
|
29
|
+
# @param [Element] element
|
30
|
+
# @param [Integer] x - element x coordinate
|
31
|
+
# @param [Integer] y - element y coordinate
|
32
|
+
#
|
33
|
+
def mouse_over(element, x: 0, y: 0)
|
34
|
+
Driver.driver.action.move_to(element.element, x, y).perform
|
35
|
+
end
|
30
36
|
|
31
|
-
|
32
|
-
Driver.driver.mouse.move_to(element.element)
|
33
|
-
end
|
37
|
+
alias_method :hover_over, :mouse_over
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
def trigger_onblur(element)
|
40
|
+
Driver.execute_script("arguments[0].focus(); arguments[0].blur(); return true", element.element)
|
41
|
+
end
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
+
# Occasionaly selenium is unable to click on elements in the DOM which have some
|
44
|
+
# interesting React goodies around the element.
|
45
|
+
def jquery_click(element)
|
46
|
+
Driver.execute_script("arguments[0].click().change();", element.element)
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
data/lib/page.rb
CHANGED
@@ -58,7 +58,7 @@ module Gridium
|
|
58
58
|
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
|
59
59
|
begin
|
60
60
|
if opts[:visible]
|
61
|
-
element = wait.until { Element.new("Finding text '#{text}'", :xpath, "//*[text()
|
61
|
+
element = wait.until { Element.new("Finding text '#{text}'", :xpath, "//*[text()=\"#{text}\"]").displayed? }
|
62
62
|
else
|
63
63
|
element = wait.until { Driver.html.include? text }
|
64
64
|
end
|
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.17
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|