webdrone 1.5.0 → 1.6.0
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 +4 -4
- data/CHANGELOG.md +41 -0
- data/lib/webdrone/browser.rb +7 -3
- data/lib/webdrone/clic.rb +6 -1
- data/lib/webdrone/form.rb +2 -2
- data/lib/webdrone/mark.rb +9 -9
- data/lib/webdrone/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cdf62a2cce8db573d203579df27407f5667783e
|
4
|
+
data.tar.gz: 27db99313aad1c4f26b0f863cdd1be81d35f9170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140491cb3a032217fee14d222f1fc34301d045e84b1d0d8e9e3929644d61e908bbfdf1e73ec36b78c7a4b5556f0d75f163be8687a4263d7e38fb66cbac7880dc
|
7
|
+
data.tar.gz: a3bbd965994875b3f8b66f8b7464022f609ccefca77461a4e36ebb7a378ed0b92e1c7131a5976dd03f3aa8668873ee9738a18c82dc66e110783a9ee1c406e199
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,47 @@ New features are summarized here.
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
## v1.6.0 - 2017-01-15
|
8
|
+
### Added
|
9
|
+
- Added `mark:` an `shot:` parameters to `a0.clic`. The following code will mark the element, take a screenshot and then click the element.
|
10
|
+
```
|
11
|
+
a0.clic.on 'something', mark: true, shot: true
|
12
|
+
```
|
13
|
+
### Changed
|
14
|
+
- Changed default to true for `quit_at_exit` in `Webdrone.create`.
|
15
|
+
- Setting default of 30 seconds to timeout parameter in `Webdrone.create`. This means the timeout is an optional parameter, for ex:
|
16
|
+
```ruby
|
17
|
+
# Before
|
18
|
+
a0 = Webdrone.create # <= ArgumentError: missing keyword: timeout
|
19
|
+
a0 = Webdrone.create timeout: 10 # setting timeout to 10 seconds
|
20
|
+
|
21
|
+
# Now
|
22
|
+
a0 = Webdrone.create # default timeout of 30 seconds
|
23
|
+
a0 = Webdrone.create timeout: 10 # overriding timeout to 10 seconds
|
24
|
+
```
|
25
|
+
- Renamed `sleep` to `delay` in `a0.mark`, for example:
|
26
|
+
```ruby
|
27
|
+
# Before
|
28
|
+
export WEBDRONE_MARK_TIMES=1
|
29
|
+
export WEBDRONE_MARK_SLEEP=0
|
30
|
+
a0.mark.on 'something'
|
31
|
+
|
32
|
+
a0.mark.on 'something', times: 2, sleep: 1
|
33
|
+
|
34
|
+
# Now
|
35
|
+
export WEBDRONE_MARK_TIMES=1
|
36
|
+
export WEBDRONE_MARK_DELAY=0
|
37
|
+
a0.mark.on 'something'
|
38
|
+
|
39
|
+
a0.mark.on 'something', times: 2, delay: 1
|
40
|
+
```
|
41
|
+
### Fixed
|
42
|
+
- Firefox using geckodriver is not supporting window resizing/positioning :-(. The following error will be ignored in the meantime:
|
43
|
+
```
|
44
|
+
Selenium::WebDriver::Error::UnsupportedOperationError: The W3C standard does not currently support setting the Window Position"
|
45
|
+
```
|
46
|
+
|
47
|
+
|
7
48
|
## v1.5.0 - 2016-08-11
|
8
49
|
### Added
|
9
50
|
- Added platform info for Webdrone (ruby) on a0_webdrone_trace.csv file
|
data/lib/webdrone/browser.rb
CHANGED
@@ -58,7 +58,7 @@ module Webdrone
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def initialize(browser: 'firefox', create_outdir: true, outdir: nil, timeout
|
61
|
+
def initialize(browser: 'firefox', create_outdir: true, outdir: nil, timeout: 30, developer: false, logger: true, quit_at_exit: true, maximize: true, error: :raise_report, win_x: nil, win_y: nil, win_w: nil, win_h: nil, use_env: true, chrome_prefs: nil, firefox_profile: nil, remote_url: nil)
|
62
62
|
env_update(Kernel.binding) if use_env
|
63
63
|
if create_outdir or outdir
|
64
64
|
outdir ||= File.join("webdrone_output", Time.new.strftime('%Y%m%d_%H%M%S'))
|
@@ -111,8 +111,12 @@ module Webdrone
|
|
111
111
|
else
|
112
112
|
win_h ||= h
|
113
113
|
end
|
114
|
-
|
115
|
-
|
114
|
+
begin
|
115
|
+
@driver.manage.window.position = Selenium::WebDriver::Point.new win_x, win_y
|
116
|
+
@driver.manage.window.resize_to(win_w, win_h)
|
117
|
+
rescue => e
|
118
|
+
puts "Ignoring error on window position/resize: #{e}"
|
119
|
+
end
|
116
120
|
else
|
117
121
|
self.maximize if maximize
|
118
122
|
end
|
data/lib/webdrone/clic.rb
CHANGED
@@ -12,8 +12,13 @@ module Webdrone
|
|
12
12
|
@a0 = a0
|
13
13
|
end
|
14
14
|
|
15
|
-
def clic(text, n: 1, all: false, visible: true)
|
15
|
+
def clic(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil, mark: false)
|
16
16
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
17
|
+
if mark
|
18
|
+
@a0.mark.mark_item(item, color: color, times: times, delay: delay, shot: shot, text: text)
|
19
|
+
elsif shot
|
20
|
+
@a0.shot.screen shot.is_a?(String) ? shot : text
|
21
|
+
end
|
17
22
|
if item.is_a? Array
|
18
23
|
item.each(&:click)
|
19
24
|
else
|
data/lib/webdrone/form.rb
CHANGED
@@ -114,8 +114,8 @@ module Webdrone
|
|
114
114
|
Webdrone.report_error(@a0, exception)
|
115
115
|
end
|
116
116
|
|
117
|
-
def mark(key, n: 1, visible: true, color: '#af1616', times: nil,
|
118
|
-
@a0.mark.mark_item self.find_item(key, n: n, visible: visible), color: color, times: times,
|
117
|
+
def mark(key, n: 1, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil)
|
118
|
+
@a0.mark.mark_item self.find_item(key, n: n, visible: visible), color: color, times: times, delay: delay, shot: shot
|
119
119
|
rescue => exception
|
120
120
|
Webdrone.report_error(@a0, exception)
|
121
121
|
end
|
data/lib/webdrone/mark.rb
CHANGED
@@ -6,17 +6,17 @@ module Webdrone
|
|
6
6
|
end
|
7
7
|
|
8
8
|
class Mark
|
9
|
-
attr_accessor :a0, :default_times, :
|
9
|
+
attr_accessor :a0, :default_times, :default_delay
|
10
10
|
|
11
11
|
def initialize(a0)
|
12
12
|
@a0 = a0
|
13
13
|
@default_times = ENV['WEBDRONE_MARK_TIMES'] || 3
|
14
|
-
@
|
14
|
+
@default_delay = ENV['WEBDRONE_MARK_DELAY'] || 0.05
|
15
15
|
end
|
16
16
|
|
17
|
-
def mark(text, n: 1, all: false, visible: true, color: '#af1616', times: nil,
|
17
|
+
def mark(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil)
|
18
18
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
19
|
-
mark_item item, color: color, times: times,
|
19
|
+
mark_item item, color: color, times: times, delay: delay, shot: shot, text: text
|
20
20
|
rescue => exception
|
21
21
|
Webdrone.report_error(@a0, exception)
|
22
22
|
end
|
@@ -29,16 +29,16 @@ module Webdrone
|
|
29
29
|
alias_method :option, :mark
|
30
30
|
alias_method :xpath, :mark
|
31
31
|
|
32
|
-
def mark_item(item, color: '#af1616', times: nil,
|
32
|
+
def mark_item(item, color: '#af1616', times: nil, delay: nil, shot: nil, text: nil)
|
33
33
|
times ||= @default_times
|
34
|
-
|
34
|
+
delay ||= @default_delay
|
35
35
|
times.times do
|
36
36
|
mark_item_border item, 'white'
|
37
|
-
sleep
|
37
|
+
sleep delay
|
38
38
|
mark_item_border item, 'black'
|
39
|
-
sleep
|
39
|
+
sleep delay
|
40
40
|
mark_item_border item, color
|
41
|
-
sleep
|
41
|
+
sleep delay
|
42
42
|
end
|
43
43
|
@a0.shot.screen shot.is_a?(String) ? shot : text if shot
|
44
44
|
item
|
data/lib/webdrone/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webdrone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldrin Martoq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|