xautobrowse 0.3.2 → 0.3.3

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: 5979e8a877238d2250096a0e3585fc480ae22817c7121f1d54dd63b900ac5829
4
- data.tar.gz: d039db6f49eedbf8d79f1dcd1220443f6edaa47e2bc8a2e7f0dc8ee9221cd815
3
+ metadata.gz: 66c28ea97bd0679cc40822147d8ea09c6bb2acd3330f89b39802c4322141a9b5
4
+ data.tar.gz: 227072f7cf0ba6bae7ec049db424063b58007c2710a2c7407837be276376ac0a
5
5
  SHA512:
6
- metadata.gz: 445263c44cbc484a5930621f63d3f99b0b2899c4cb92f7d969cddedb98dd6a9733b4d590be6037e1bd5de7e80ce7d26bdd0af215db8089b4cf3d4efba18fbfb5
7
- data.tar.gz: cba6c382f0255c4d8d48a0eb5ed6269042e333833562a3850904ad5434f7e9e7ef0abfafd1f4f4059eb185acb0f1334e1478039d8c1104df9d3bb8f7962dc58e
6
+ metadata.gz: c3126b5a591833c1c16dee132b0518c356c6db5867f5806810fc88901fd54d3aa2176f3ca09fe94a7fa3292eef5882d2926f69af56448aec12c2da2bee2b16a3
7
+ data.tar.gz: 8a88eb43738c442f8f7de66afb88a96d9cbb0f6be8e53896fd0089d19076b2407ba8a5d81eab83290408e23477ab7f48eb941a31abb1b20b9ec4d252949c46f0
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- EY���N��
2
- (H���Ϫ4��G���`�̊�����F����z���
3
- �lh�Iڨ��6�Z\\��j�#_L�Ƿ ��@���n��:��\{&�WL`}���0������<wv�����K��9l@FB:^��e ��j�D�PƔa�}��…������W��r��>��wZ|��{���w��u<�Қ�-R-�S��J�-�wܜy5{�<�r.�f�R>�Ck�o]$�"�9)��:֞o�s{���džҀ
1
+ ��C/ �sw̸��4z�g��ɲ-w9��@�P���EjGgOat``����!#��F �?��K��}W
2
+ �����Ŕm?�1W��L�����$c:�.�4k���lo�B{eeV�6]w��Jf�;���`�*‘Q
@@ -9,6 +9,8 @@
9
9
 
10
10
  # revision log:
11
11
 
12
+ # 15 Oct 2018: feature: The keyword *context* can be used to specify the
13
+ # parent element of the document
12
14
  # 5 Sep 2018: feature: A new tab can now be opened if it does not exist.
13
15
  # 4 Sep 2018: feature: Tabs can now be traversed using the XTabbedWindow gem
14
16
  # 23 Jun 2018: feature: A new Window can now be created which attaches itself
@@ -124,14 +126,17 @@ class XAutoBrowse
124
126
  end
125
127
 
126
128
  attr_reader :window
127
- attr_accessor :actions
129
+ attr_accessor :actions, :context
130
+
131
+ # note: context is the parent of the document element e.g. frames[0]
132
+
128
133
 
129
134
 
130
135
  def initialize(browser= :firefox, new_window: true, debug: false,
131
- sps: false, clicks: {}, scan_tabs: !new_window)
136
+ sps: false, clicks: {}, scan_tabs: !new_window, context: nil)
132
137
 
133
138
  @browser, @debug, @sps, @clicks = browser.to_sym, debug, sps, clicks
134
- @new_window = new_window
139
+ @new_window, @context = new_window, context
135
140
 
136
141
  @window = Window.new(browser, new_win: new_window, scan_tabs: scan_tabs)
137
142
 
@@ -167,7 +172,9 @@ class XAutoBrowse
167
172
 
168
173
  def click(name)
169
174
 
170
- web_console {|x| x.enter @clicks[name] + '.click();' }
175
+ web_console do |x|
176
+ x.enter [@context, @clicks[name]].compact.join('.') + '.click();'
177
+ end
171
178
 
172
179
  end
173
180
 
@@ -296,6 +303,12 @@ class XAutoBrowse
296
303
 
297
304
  alias cr carriage_return
298
305
 
306
+ def method_missing(method_name, *args)
307
+ if method_name.to_s =~ /^alt/ then
308
+ send_keys method_name
309
+ end
310
+ end
311
+
299
312
  def open_web_console()
300
313
 
301
314
  console = @browser == :firefox ? :ctrl_shift_k : :ctrl_shift_i
@@ -381,6 +394,9 @@ class XAutoBrowse
381
394
  @window.activate(); XDo::Keyboard.simulate("{TAB}" * n)
382
395
  end
383
396
 
397
+ # determines if the given tabbed window title exists
398
+ # for the given tabbed windows
399
+ #
384
400
  def tab?(s)
385
401
  @window.tab?(s)
386
402
  end
@@ -395,9 +411,13 @@ class XAutoBrowse
395
411
  "getElementById(\"#{id}\")"
396
412
  end
397
413
 
398
- ['r = document.' + cmd, "r.value = \"\"", "r.focus()"].each do |x|
399
- console.enter x
400
- end
414
+ a = [
415
+ 'r = ' + [@context, 'document'].compact.join('.') + '.' + cmd,
416
+ "r.value = \"\"",
417
+ "r.focus()"
418
+ ]
419
+
420
+ a.each {|x| console.enter x }
401
421
 
402
422
  end
403
423
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xautobrowse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  UkT65Cjj3pGfXSA+uRiXo7EXRM2Xft7NA1wuE91g2PYjRb8GvdqjxrgF1gp+LHtf
31
31
  Gwk=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-09-05 00:00:00.000000000 Z
33
+ date: 2018-10-15 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: xtabbedwindow
@@ -41,7 +41,7 @@ dependencies:
41
41
  version: '0.1'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.1.1
44
+ version: 0.1.4
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,7 +51,7 @@ dependencies:
51
51
  version: '0.1'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.1
54
+ version: 0.1.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokorexi
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  version: '1.1'
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 1.1.1
84
+ version: 1.1.2
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,7 +91,7 @@ dependencies:
91
91
  version: '1.1'
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 1.1.1
94
+ version: 1.1.2
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: simplepubsub
97
97
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file