xautobrowse 0.2.5 → 0.2.6

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: b13f0fe6a806cb777a07bab64ecd36a171b6d1b2
4
- data.tar.gz: 42615bc7a9ac014d314a5c7e44f26a2c932bc028
3
+ metadata.gz: be7edcbc3108b110f0785f5402c5d2030375d260
4
+ data.tar.gz: 545779ec6e9792413c45a6d7d2cf46c2a96b42dd
5
5
  SHA512:
6
- metadata.gz: 17ee85efa2ac9535950d83237c94120f7ac3083eb805c8e56e486ad4dcb8d09170a022642d07b1a6ea01bed5935a58fcab7d74c9509553d713c85f97dbf27637
7
- data.tar.gz: a30be141e310ae8d488e7c554e053b736457e11f344eae9f7da2c38de2e032daa0035d5ff7095ec8c53cfc8c5fbe03add8f0ef51dbc4137290188af459d14d0f
6
+ metadata.gz: 0ecb265dfbefd02ab544756ac16334ff15871663dec0f262f1054fe6e68850556899487000f3d07acacc17df26786714c706cbf74b7ef6f8df6c575f1a901516
7
+ data.tar.gz: 38b75cccfa5c3f2414fcc8fcfc98f56fc4afe348b1caf66ed3f0f59771308008a51bfe7b882be3889e23b5b5b64c69b4024dca226ee6ed577b42aaea74970602
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- �Y�֥�D͸4Œ1%Z��?b@�"ߡ���o^�F���ى�n�Yn���.����_�r�/�"��!���K|T"��}�3����>���Q0g��*;�H̸�pɸ�=��a�Y��s\<�^�%�����x(�|��5���us-M�溴�2`�t�'�\e����4��Q�~�J,��qH�����MϥG��b7��␪i��f
1
+ =_L'���&��,�=d�����G>Td�tbÏ<�ᒿ�DB�t�k=b��Y6z������B��ݳa��q?�UQ��;�a�,)��Յ�m���Y�բ���"3�x����L����<�N���/̙E�:-2�W�۞pzh�\gl�τqoswȜ@00u߀�rj��o��Xb���Xmw�]�]^7*�K�Mn��z��
data/lib/xautobrowse.rb CHANGED
@@ -6,8 +6,11 @@
6
6
  # Primarily tested using Firefox (52.6.0 (64-bit)) on Debian.
7
7
 
8
8
 
9
+
9
10
  # revision log:
10
11
 
12
+ # 23 Jun 2018: feature: A new Window can now be created which attaches itself
13
+ # to the most recent application window created
11
14
  # 12 Feb 2018: bug fix: Implemented the missing method ctrl_shift_k() used
12
15
  # to access developer tools from Firefox. The browser variable is now a
13
16
  # symbolic string instead of a regular string as required by the code.
@@ -54,25 +57,33 @@ class XAutoBrowse
54
57
 
55
58
  class Window
56
59
 
57
- def initialize(browser)
60
+ def initialize(browser=nil)
58
61
 
59
62
  @wm = WMCtrl.instance
60
- spawn(browser.to_s); sleep 3
61
63
 
62
- id = XDo::XWindow.wait_for_window(browser.to_s)
63
- xwin = XDo::XWindow.new(id)
64
- title = xwin.title
65
- puts 'title: ' + title.inspect if @debug
64
+ if browser then
65
+ spawn(browser.to_s); sleep 3
66
+
67
+ id = XDo::XWindow.wait_for_window(browser.to_s)
68
+
69
+ xwin = XDo::XWindow.new(id)
70
+ title = xwin.title
71
+ puts 'title: ' + title.inspect if @debug
66
72
 
67
- # WMCtrl is used because XDo is problematic at trying to activate a window
73
+ # WMCtrl is used because XDo is problematic at trying to activate a window
74
+
75
+ a = @wm.list_windows true
76
+ puts 'a: ' + a.inspect if @debug
77
+ r = a.reverse.find {|x| x[:title] =~ /#{browser}$/i}
78
+ else
79
+ a = @wm.list_windows true
80
+ r = a.last
81
+ end
68
82
 
69
- a = @wm.list_windows true
70
- puts 'a: ' + a.inspect if @debug
71
- r = a.reverse.find {|x| x[:title] =~ /#{browser}$/i}
72
83
  @id = r[:id]
73
84
 
74
85
  @x, @y, @width, @height = *r[:geometry]
75
- sleep 4
86
+ sleep 4 unless browser
76
87
 
77
88
  end
78
89
 
@@ -277,6 +288,10 @@ class XAutoBrowse
277
288
 
278
289
  alias web_console open_web_console
279
290
 
291
+ def new_window()
292
+ @window = Window.new
293
+ end
294
+
280
295
  # Takes a screenshot of the web page. Images are stored in ~/Pictures
281
296
  #
282
297
  def screenshot(filename=Time.now\
@@ -378,7 +393,17 @@ class XAutoBrowse
378
393
 
379
394
  # input some text
380
395
  #
381
- def enter(s) type(s); sleep 0.8; carriage_return(); sleep 1 end
396
+ def enter(s=nil)
397
+
398
+ if s then
399
+ type(s)
400
+ sleep 0.8
401
+ end
402
+
403
+ carriage_return()
404
+ sleep 1
405
+
406
+ end
382
407
 
383
408
 
384
409
  private
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.5
4
+ version: 0.2.6
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-02-12 00:00:00.000000000 Z
33
+ date: 2018-06-23 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: xdo
metadata.gz.sig CHANGED
Binary file