xautobrowse 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/xautobrowse.rb +34 -11
- data.tar.gz.sig +2 -3
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a98ad02b9ca15c528bd77d851d96d1405a782f3
|
4
|
+
data.tar.gz: 40feedea4769332549a574708afb3198343f8130
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d654981f154feeb36bbe40448f583024e6c9038033307be1a3bd71f9a191dbdd5b6c347ce7db9fc40375e054b4fdcdf9ab33322fe0ec15ea43be56c51e1664d
|
7
|
+
data.tar.gz: d6cb140ebacd73bb129d003e7672b3e981439745890fe37425a0b60bf1b7dae804e68042bfd5d49471f6b5258a23588cb2ba9915d96bc4732d62705fa0896bdf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/xautobrowse.rb
CHANGED
@@ -8,6 +8,9 @@
|
|
8
8
|
|
9
9
|
# modifications
|
10
10
|
|
11
|
+
# 30 Jan 2018: feature: Now uses the gem universal_dom_remote to
|
12
|
+
# connect to the browser via websockets.
|
13
|
+
# A window can now be closed remotely.
|
11
14
|
# 28 Jan 2018: feature: Chromium is now supported.
|
12
15
|
# A custom accesskey can now be used to jump to an element.
|
13
16
|
|
@@ -18,6 +21,7 @@ require 'clipboard'
|
|
18
21
|
require 'xdo/mouse'
|
19
22
|
require 'xdo/keyboard'
|
20
23
|
require 'xdo/xwindow'
|
24
|
+
require 'sps-pub'
|
21
25
|
require 'universal_dom_remote'
|
22
26
|
|
23
27
|
|
@@ -26,11 +30,8 @@ class XAutoBrowse
|
|
26
30
|
at_exit() do
|
27
31
|
|
28
32
|
puts 'shutting down ...'
|
29
|
-
EventMachine.stop
|
30
|
-
sleep
|
31
|
-
`ruby -r sps-pub -e "SPSPub.notice('shutdown', host: \
|
32
|
-
'127.0.0.1', port: '55000'); sleep 0.4"`
|
33
|
-
|
33
|
+
EventMachine.stop
|
34
|
+
SPSPub.notice('shutdown', host: '127.0.0.1', port: '55000'); sleep 0.5
|
34
35
|
|
35
36
|
end
|
36
37
|
|
@@ -40,11 +41,11 @@ class XAutoBrowse
|
|
40
41
|
@browser, @debug = browser, debug
|
41
42
|
|
42
43
|
@wm = WMCtrl.instance
|
43
|
-
spawn(browser.to_s); sleep
|
44
|
+
spawn(browser.to_s); sleep 3
|
44
45
|
|
45
46
|
id = XDo::XWindow.wait_for_window(browser)
|
46
|
-
xwin = XDo::XWindow.new(id)
|
47
|
-
title = xwin.title
|
47
|
+
@xwin = XDo::XWindow.new(id)
|
48
|
+
title = @xwin.title
|
48
49
|
puts 'title: ' + title.inspect if @debug
|
49
50
|
|
50
51
|
# WMCtrl is used because XDo is problematic at trying to activate a window
|
@@ -58,6 +59,7 @@ class XAutoBrowse
|
|
58
59
|
Thread.new { open_web_console(); sleep 1; close_web_console() }
|
59
60
|
|
60
61
|
connect()
|
62
|
+
|
61
63
|
end
|
62
64
|
|
63
65
|
# custom accesskey (e.g. CTRL+SHIFT+S) typically used to reference an
|
@@ -70,6 +72,7 @@ class XAutoBrowse
|
|
70
72
|
def activate()
|
71
73
|
@wm.action_window(@id, :activate)
|
72
74
|
end
|
75
|
+
|
73
76
|
|
74
77
|
# Attaches the SPS client to the web browser. The SPS broker must be
|
75
78
|
# started before the code can be attached. see start_broker()
|
@@ -78,15 +81,21 @@ class XAutoBrowse
|
|
78
81
|
|
79
82
|
activate()
|
80
83
|
open_web_console(); sleep 1
|
81
|
-
|
84
|
+
|
85
|
+
clipboard = Clipboard.paste
|
82
86
|
Clipboard.copy javascript(); sleep 1
|
83
87
|
ctrl_v(); sleep 0.5
|
84
88
|
carriage_return()
|
85
89
|
|
86
90
|
close_web_console() if autohide
|
91
|
+
Clipboard.copy clipboard
|
87
92
|
|
88
93
|
end
|
89
94
|
|
95
|
+
def close()
|
96
|
+
ctrl_w()
|
97
|
+
end
|
98
|
+
|
90
99
|
def close_web_console()
|
91
100
|
activate()
|
92
101
|
ctrl_shift_i()
|
@@ -97,7 +106,7 @@ class XAutoBrowse
|
|
97
106
|
def connect()
|
98
107
|
|
99
108
|
start_broker()
|
100
|
-
sleep
|
109
|
+
sleep 4
|
101
110
|
connect_controller()
|
102
111
|
end
|
103
112
|
|
@@ -137,10 +146,19 @@ class XAutoBrowse
|
|
137
146
|
# paste
|
138
147
|
#
|
139
148
|
def ctrl_v() send_keys(:ctrl_v) end
|
149
|
+
|
150
|
+
# close the current window
|
151
|
+
#
|
152
|
+
def ctrl_w() send_keys(:ctrl_w) end
|
140
153
|
|
141
154
|
# developer tools
|
142
155
|
#
|
143
156
|
def ctrl_shift_i() send_keys(:ctrl_shift_i) end
|
157
|
+
|
158
|
+
def height=(val)
|
159
|
+
@height = val
|
160
|
+
@wm.action_window(@id, :move_resize, 0, @x, @y, @width, @height)
|
161
|
+
end
|
144
162
|
|
145
163
|
# submit a form by pressing return
|
146
164
|
#
|
@@ -186,7 +204,7 @@ class XAutoBrowse
|
|
186
204
|
console = @browser == :firefox ? :ctrl_shift_k : :ctrl_shift_i
|
187
205
|
method(console).call # web console
|
188
206
|
|
189
|
-
sleep
|
207
|
+
sleep 2
|
190
208
|
|
191
209
|
end
|
192
210
|
|
@@ -250,6 +268,11 @@ class XAutoBrowse
|
|
250
268
|
|
251
269
|
end
|
252
270
|
|
271
|
+
def width=(val)
|
272
|
+
@width = val
|
273
|
+
@wm.action_window(@id, :move_resize, 0, @x, @y, @width, @height)
|
274
|
+
end
|
275
|
+
|
253
276
|
# input some text
|
254
277
|
#
|
255
278
|
def enter(s) type(s); sleep 0.8; carriage_return(); sleep 1 end
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
e�C�����"�D/C��ìD�
|
1
|
+
� }(E�EweV7�����.z�l���c���e�JO{ྕ�u4p��H��u��E�ZJ[�;vٔ��YMWi���V&-����l�K��AW��>H�-y��~��Jy���Yul�)9j<��������3�J��RЂ����Ӑ����3��ZA�q82�!"��#�;(��et&�S�-p������nX�����VB�Ε�m-����{�J5~C��n1V�
|
2
|
+
�"+��_�-5E|�\/��9H[�t|W�Ѷz#}
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|