ferrumwizard 0.3.1 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 138f77d111207f978a986515188afd1b8fa19c570dba80b5bb9c9e4e8dd4692d
4
- data.tar.gz: 62931555c44ce301d9b596c0d2c9b27298490c8b178ead98e2da019a85d8a80f
3
+ metadata.gz: 49e32005fe2c6c30493457c7f78fb5abe88449eb8c91b78d6b1133a7eead4200
4
+ data.tar.gz: f917d4834b0f2590effa1a33445828b287a1cb5859d51d3b666a25aa885bcf31
5
5
  SHA512:
6
- metadata.gz: d96e4c5fcc5444887423396c8849957c90a5ae283c02897a3d5f6d7856a36eeb03d461dc7172c10f5549f6e4962310e1cbd18874af518bc8abeae973a7cfe121
7
- data.tar.gz: ae8c245f5ee6abb4970735e5ca12174f8917d24369ba008ac9d9eacd2a060808d297fe5c26e3c54f4f53cb4bfb538a1f1ad8181acad1801edf1d0940e2ea2edb
6
+ metadata.gz: 90ead6b645ed3e6717351f6c2b92fe9f60e98c581b9b02934ebdd02a8fdb581906b62c0696dd67907149c709cc2dd58b2d8da8303b918e3226df70ec8db164b3
7
+ data.tar.gz: e69f860e4a22a8fe51c6a5baca472bc288c301d9f140f3ec9b6a54434b59f008ce8d963f6091d5d793c2fafe9bf8b1493f9f2f80e6fe43140cc95fbc34bfe6dc
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/ferrumwizard.rb CHANGED
@@ -32,6 +32,31 @@ class FerrumWizard
32
32
  end
33
33
  end
34
34
 
35
+ def at_xpath(s)
36
+ @browser.at_xpath(s)
37
+ end
38
+
39
+ def body()
40
+ @browser.body
41
+ end
42
+
43
+ def click(xpath)
44
+ r = @browser.at_xpath(xpath)
45
+ r.focus.click
46
+ sleep 0.4
47
+ end
48
+
49
+ def input(xpath, value)
50
+
51
+ r = @browser.at_xpath(xpath)
52
+ puts 'xpath: ' + xpath.inspect if @debug
53
+ raise 'invalid xpath -> ' + xpath.inspect unless r
54
+ sleep 1 if @debug
55
+ r.focus.type value
56
+ sleep 1
57
+
58
+ end
59
+
35
60
  def inspect()
36
61
  "#<FerrumWizard>"
37
62
  end
@@ -62,7 +87,7 @@ class FerrumWizard
62
87
  if @debug then
63
88
  puts 'name: ' + h['name']
64
89
  puts 'h: ' + h.inspect
65
- sleep 0.4
90
+ sleep 0.1
66
91
  end
67
92
 
68
93
  browser.cookies.set(name: h['name'], value: h['value'],
@@ -181,6 +206,34 @@ class FerrumWizard
181
206
 
182
207
  end
183
208
 
209
+ # selects an item from a nested drop-down list
210
+ #
211
+ def select(xpath, title)
212
+
213
+ e = @browser.at_xpath(xpath)
214
+ raise 'invalid xpath -> ' + xpath.inspect unless e
215
+
216
+ titles = if e.tag_name == 'select' then
217
+ e.xpath('option').map(&:text)
218
+ else
219
+ e.xpath('select/option').map(&:text)
220
+ end
221
+
222
+ r = titles.grep /#{title}/i
223
+ n = titles.index(r.first)
224
+ select_down(e, n)
225
+ sleep 0.5
226
+
227
+ end
228
+
229
+ # presses the down arrow n number of times to select a drop-down list item
230
+ #
231
+ def select_down(e, n)
232
+ e.focus
233
+ n.times { e.type(:down); sleep 0.4}
234
+ e.click
235
+ end
236
+
184
237
  def submit(h)
185
238
 
186
239
  e = nil
@@ -197,6 +250,10 @@ class FerrumWizard
197
250
 
198
251
  end
199
252
 
253
+ def to_doc()
254
+ @doc
255
+ end
256
+
200
257
  def to_rb()
201
258
  end
202
259
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferrumwizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,28 +35,8 @@ cert_chain:
35
35
  FK+cyrQNA9DLJYJuz6uO7Z+gXZWjwAO38LUwF01w49asSv/5ZH2HH/EauX5xWpe+
36
36
  ry6lYQlb8j50Iys5elAy1p0i
37
37
  -----END CERTIFICATE-----
38
- date: 2022-04-13 00:00:00.000000000 Z
38
+ date: 2022-06-01 00:00:00.000000000 Z
39
39
  dependencies:
40
- - !ruby/object:Gem::Dependency
41
- name: rexle
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1.5'
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 1.5.14
50
- type: :runtime
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '1.5'
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: 1.5.14
60
40
  - !ruby/object:Gem::Dependency
61
41
  name: ferrum
62
42
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file