xautobrowse 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd96b9501e28095dc7b9f4e2c7e24c9a9ebdbd2f
4
- data.tar.gz: 63143f4863cd56c5076d4142fa434287001bcb15
3
+ metadata.gz: aca9c4b7401d1d58d6c88c03b5072ff7c3a875a9
4
+ data.tar.gz: 8ee79349df64265d9685637d3b18bba29e594b45
5
5
  SHA512:
6
- metadata.gz: 15235e79acf072fad0b58a7c68b561ea1d66d5748278f150781f3e9e66d8ed6b6759a08ceb6d49ee9ed1637faae72a8db2f26a13e49b5cc31c48796148f92ef7
7
- data.tar.gz: 9bc862a4b3ca340f7a1dedd2742400c348879460a7e1376087e7e934247f6eba2a67827d3f7eccf565e2cc6fb885669992d749c87c66dbc4e70618454977dec3
6
+ metadata.gz: d4072cf6251c9e6e28c3666310a6062fab5a0c51aef90638fbc07229d1f17a62d08609696f2fe5e5efcf24f66532c1c8449918f08696f05c74b13aaae34d354a
7
+ data.tar.gz: ff08d761a6d031dcfff0361a74829acdcb4622fa65dda3d3b16d70cc9b714c29bc26a48cc2faed11082e931d0c56d3d30c84100279d863c529fef20cb406bcb5
checksums.yaml.gz.sig CHANGED
@@ -1,4 +1 @@
1
- ���`a<_|�@���8<�� r��B_�+�oWv]H
2
- M�+���x2h2�U��"K�
3
- WZE�R���)+U��]�38��!ay�b�0p8wk���򒻋
4
- urјⲮ��6����6�Z+���[�4ʂ��O[�����6t�!�����UXƆ��&���� נ�!+�� j��[_�<8*]�9�b�!_l�+��9C�|�eCN��SsǴ.i��:����R!�;����d2���H�O��4�K:���,��
1
+ t_v�n���2Z��"=R��~���O�(�Ų�C:�=}g�c��S�dD�ʦ�x� ��4�}B�f{��J�ϒ^�̚|�r}�6�� ��}f�״�5��7A��3��:ú���emQyd
data/lib/xautobrowse.rb CHANGED
@@ -6,8 +6,10 @@
6
6
  # Primarily tested using Firefox (52.6.0 (64-bit)) on Debian.
7
7
 
8
8
 
9
- # modifications
9
+ # revision log:
10
10
 
11
+ # 31 Jan 2018: feature: Implemented XAutoBrowse#click which accepts a key of
12
+ # an element to be clicked e.g. click :logout
11
13
  # 30 Jan 2018: feature: Now uses the gem universal_dom_remote to
12
14
  # connect to the browser via websockets.
13
15
  # A window can now be closed remotely.
@@ -16,6 +18,12 @@
16
18
  # 28 Jan 2018: feature: Chromium is now supported.
17
19
  # A custom accesskey can now be used to jump to an element.
18
20
 
21
+ # Helpful tip: To identify the id for a web page element, using the mouse
22
+ # right-click on the element, select inspect. Then from the inspection
23
+ # window, hover the mouse over the element code, using the mouse,
24
+ # right-click, select copy, inner HTML.
25
+ # Then paste the code to a new notepad document for inspection.
26
+
19
27
 
20
28
  require 'wmctrl'
21
29
  require 'nokorexi'
@@ -91,15 +99,16 @@ class XAutoBrowse
91
99
  end
92
100
 
93
101
  attr_reader :window
102
+ attr_accessor :actions
94
103
 
95
104
 
96
- def initialize(browser= :firefox, debug: false, sps: false)
105
+ def initialize(browser= :firefox, debug: false, sps: false, clicks: {})
97
106
 
98
- @browser, @debug = browser, debug
107
+ @browser, @debug, @clicks = browser, debug, clicks
99
108
 
100
109
  @window = Window.new browser
101
110
  sleep 4
102
- Thread.new { open_web_console(); sleep 1; close_web_console() }
111
+ Thread.new { open_web_console() { sleep 1 } }
103
112
 
104
113
  @sps = sps
105
114
  connect() if sps
@@ -111,7 +120,7 @@ class XAutoBrowse
111
120
  #
112
121
  def accesskey(key) send_keys(key.to_sym) end
113
122
 
114
- alias access_key accesskey
123
+ alias access_key accesskey
115
124
 
116
125
  # Attaches the SPS client to the web browser. The SPS broker must be
117
126
  # started before the code can be attached. see start_broker()
@@ -131,6 +140,12 @@ class XAutoBrowse
131
140
 
132
141
  end
133
142
 
143
+ def click(name)
144
+
145
+ open_web_console {|x| x.enter @clicks[name] + '.click();' }
146
+
147
+ end
148
+
134
149
  def close()
135
150
  ctrl_w()
136
151
  end
@@ -168,7 +183,7 @@ class XAutoBrowse
168
183
  def copy_source()
169
184
 
170
185
  view_source(); sleep 3
171
- select all()
186
+ select_all()
172
187
  sleep 1
173
188
  ctrl_c() # copy the source code to the clipboard
174
189
  sleep 1
data.tar.gz.sig CHANGED
Binary file
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.2.2
4
+ version: 0.2.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-01-30 00:00:00.000000000 Z
33
+ date: 2018-01-31 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: xdo
metadata.gz.sig CHANGED
Binary file