gridium 0.1.16 → 0.1.17
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/gridium/version.rb +1 -1
- data/lib/page.rb +23 -6
- 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: 0243e90dc04686fa9dd3200eee663b9238dc88bc
|
4
|
+
data.tar.gz: 5bd35b0d358ced862c13feabef4772a73924460a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72aa492030136743d2807f645abe6a751448f1cad8bdcab669742f0a8314644de396df415482047c8a86124381c376479eb889ec6233f2319f274980d5b00fff
|
7
|
+
data.tar.gz: be03d5a63d31c63608613caab100a584a4dd6b5db152988e49f685b1c682a5a37f6b42b3be518d583acaec756e0e62ffda377aa486f336010f58191a9aae2361
|
data/lib/gridium/version.rb
CHANGED
data/lib/page.rb
CHANGED
@@ -103,19 +103,36 @@ module Gridium
|
|
103
103
|
Driver.driver.find_elements(by, locator).first
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
107
|
-
Element.new("Clicking #{
|
106
|
+
def click_on(text)
|
107
|
+
Element.new("Clicking #{text}", :xpath, "//*[text()='#{text}')]").click
|
108
108
|
end
|
109
109
|
|
110
|
-
|
110
|
+
# Click the link on the page
|
111
|
+
# @param [String] link_text - Text of the link to click
|
112
|
+
# @param [Integer] link_index (optional) - With multiple links on the page with the same name, click on the specified link index
|
113
|
+
def click_link(link_text, link_index: nil)
|
114
|
+
if link_index
|
115
|
+
Element.new("Clicking #{link_text} Link (#{link_index})", :xpath, "(//a[contains(., '#{link_text}')])[#{link_index}]").click
|
116
|
+
else
|
117
|
+
Element.new("Clicking #{link_text} Link", :xpath, "//a[contains(., '#{link_text}')]").click
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Click the button on the page
|
122
|
+
# @param [String] link_text - Text of the link to click
|
123
|
+
# @param [Integer] link_index - With multiple links on the page with the same name, click on the specified link index (Defaults to first link found)
|
124
|
+
def click_button(button_name, button_index: nil)
|
111
125
|
#The button maybe a link that looks like a button - we want to handle both
|
112
|
-
|
126
|
+
if button_index
|
127
|
+
button = Element.new("Clicking #{button_name} button (#{button_index})", :xpath, "(//button[contains(., '#{button_name}')])[#{button_index}]")
|
128
|
+
else
|
129
|
+
button = Element.new("Clicking #{button_name} button", :xpath, "//button[contains(., '#{button_name}')]")
|
130
|
+
end
|
113
131
|
begin
|
114
132
|
button.click
|
115
133
|
rescue Exception
|
116
134
|
Log.debug("Button not found - Attempting Link - speed up test by using click_link method if this works...")
|
117
|
-
|
118
|
-
link.click
|
135
|
+
click_link button_name, link_index: button_index
|
119
136
|
end
|
120
137
|
end
|
121
138
|
|
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: 0.1.
|
4
|
+
version: 0.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: 2016-
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|