webdrone 1.6.2 → 1.7.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/.ruby-version +1 -1
- data/CHANGELOG.md +24 -4
- data/lib/webdrone/clic.rb +2 -2
- data/lib/webdrone/find.rb +14 -14
- data/lib/webdrone/form.rb +15 -15
- data/lib/webdrone/html.rb +2 -2
- data/lib/webdrone/mark.rb +2 -2
- data/lib/webdrone/text.rb +3 -3
- data/lib/webdrone/version.rb +1 -1
- data/lib/webdrone/vrfy.rb +2 -2
- data/webdrone.gemspec +3 -3
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de07d3e1cc368936c87a52c2ab91499e7665bf0a
|
4
|
+
data.tar.gz: 60aef6556d1293c65debedeb7a04c6d69034939b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21f4408f762239675ed1ffc80b09697b1366fcee818a8f0cc5afa4eba566af3bc1a393184c3b97ae31c3dc413105888a3d945394ed4474ea95bb4daccad6d552
|
7
|
+
data.tar.gz: 46222e2425d4cb564ccd5d79dddcd69b8065e301119930e659a3731e86d8abc5ea9df4e91b707c25f1a013093c309cf8b459377a0d6d0018685c07ca571aa75d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.4.1
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,28 @@ New features are summarized here.
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
## v.1.7.0 - 2017-08-14
|
8
|
+
### Added
|
9
|
+
- Find children elements of a parent element. For ex, given the following HTML:
|
10
|
+
```HTML
|
11
|
+
<div id="objects">
|
12
|
+
<a>Create</a>
|
13
|
+
</div>
|
14
|
+
<div id="properties">
|
15
|
+
<a>Create</a>
|
16
|
+
</div>
|
17
|
+
```
|
18
|
+
```ruby
|
19
|
+
objs = a0.find.id 'objects'
|
20
|
+
prps = a0.find.id 'properties'
|
21
|
+
|
22
|
+
# click properties link
|
23
|
+
a0.clic.on 'Create', parent: prps
|
24
|
+
# click objects link
|
25
|
+
a0.clic.on 'Create', parent: objs
|
26
|
+
```
|
27
|
+
- parent is supported in the following verbs: `a0.clic.*`, `a0.find.*`, `a0.form.*`, `a0.html.*`, `a0.mark.*`, `a0.text.*` and `a0.vrfy.*`
|
28
|
+
|
7
29
|
## v.1.6.2 - 2017-04-11
|
8
30
|
### Changed
|
9
31
|
- Changed default preferences for chrome, disabling the password save dialog.
|
@@ -26,7 +48,7 @@ a0 = Webdrone.create timeout: 10 # setting timeout to 10 seconds
|
|
26
48
|
|
27
49
|
# Now
|
28
50
|
a0 = Webdrone.create # default timeout of 30 seconds
|
29
|
-
a0 = Webdrone.create timeout: 10 # overriding timeout to 10 seconds
|
51
|
+
a0 = Webdrone.create timeout: 10 # overriding timeout to 10 seconds
|
30
52
|
```
|
31
53
|
- Renamed `sleep` to `delay` in `a0.mark`, for example:
|
32
54
|
```ruby
|
@@ -47,7 +69,7 @@ a0.mark.on 'something', times: 2, delay: 1
|
|
47
69
|
### Fixed
|
48
70
|
- Firefox using geckodriver is not supporting window resizing/positioning :-(. The following error will be ignored in the meantime:
|
49
71
|
```
|
50
|
-
Selenium::WebDriver::Error::UnsupportedOperationError: The W3C standard does not currently support setting the Window Position"
|
72
|
+
Selenium::WebDriver::Error::UnsupportedOperationError: The W3C standard does not currently support setting the Window Position"
|
51
73
|
```
|
52
74
|
|
53
75
|
|
@@ -292,5 +314,3 @@ ruby test-script-01.rb
|
|
292
314
|
- Developer mode: a console appears when an error occurs. The console has the context of your script, so you can debug them easily.
|
293
315
|
- New option `Webdrone.create` `developer: true` to enable developer mode described above (by default is `false`).
|
294
316
|
- Added optional parameters `n:`, `visible:` to all commands in `a0.form`: `set`, `get`, `clic`, `mark` and `submit`.
|
295
|
-
|
296
|
-
|
data/lib/webdrone/clic.rb
CHANGED
@@ -12,8 +12,8 @@ module Webdrone
|
|
12
12
|
@a0 = a0
|
13
13
|
end
|
14
14
|
|
15
|
-
def clic(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil, mark: false)
|
16
|
-
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
15
|
+
def clic(text, n: 1, all: false, visible: true, color: '#af1616', times: nil, delay: nil, shot: nil, mark: false, parent: nil)
|
16
|
+
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, parent: parent
|
17
17
|
if mark
|
18
18
|
@a0.mark.mark_item(item, color: color, times: times, delay: delay, shot: shot, text: text)
|
19
19
|
elsif shot
|
data/lib/webdrone/find.rb
CHANGED
@@ -12,51 +12,51 @@ module Webdrone
|
|
12
12
|
@a0 = a0
|
13
13
|
end
|
14
14
|
|
15
|
-
def id(text, n: 1, all: false, visible: true)
|
15
|
+
def id(text, n: 1, all: false, visible: true, parent: nil)
|
16
16
|
@a0.wait.for do
|
17
|
-
items = @a0.driver.find_elements :id, text
|
17
|
+
items = (parent || @a0.driver).find_elements :id, text
|
18
18
|
choose(items, n, all, visible)
|
19
19
|
end
|
20
20
|
rescue => exception
|
21
21
|
Webdrone.report_error(@a0, exception)
|
22
22
|
end
|
23
23
|
|
24
|
-
def css(text, n: 1, all: false, visible: true)
|
24
|
+
def css(text, n: 1, all: false, visible: true, parent: nil)
|
25
25
|
@a0.wait.for do
|
26
|
-
items = @a0.driver.find_elements :css, text
|
26
|
+
items = (parent || @a0.driver).find_elements :css, text
|
27
27
|
choose(items, n, all, visible)
|
28
28
|
end
|
29
29
|
rescue => exception
|
30
30
|
Webdrone.report_error(@a0, exception)
|
31
31
|
end
|
32
32
|
|
33
|
-
def link(text, n: 1, all: false, visible: true)
|
34
|
-
self.xpath XPath::HTML.link(text).to_s, n: n, all: all, visible: visible
|
33
|
+
def link(text, n: 1, all: false, visible: true, parent: nil)
|
34
|
+
self.xpath XPath::HTML.link(text).to_s, n: n, all: all, visible: visible, parent: parent
|
35
35
|
rescue => exception
|
36
36
|
Webdrone.report_error(@a0, exception)
|
37
37
|
end
|
38
38
|
|
39
|
-
def button(text, n: 1, all: false, visible: true)
|
40
|
-
self.xpath XPath::HTML.button(text).to_s, n: n, all: all, visible: visible
|
39
|
+
def button(text, n: 1, all: false, visible: true, parent: nil)
|
40
|
+
self.xpath XPath::HTML.button(text).to_s, n: n, all: all, visible: visible, parent: parent
|
41
41
|
rescue => exception
|
42
42
|
Webdrone.report_error(@a0, exception)
|
43
43
|
end
|
44
44
|
|
45
|
-
def on(text, n: 1, all: false, visible: true)
|
46
|
-
self.xpath XPath::HTML.link_or_button(text).to_s, n: n, all: all, visible: visible
|
45
|
+
def on(text, n: 1, all: false, visible: true, parent: nil)
|
46
|
+
self.xpath XPath::HTML.link_or_button(text).to_s, n: n, all: all, visible: visible, parent: parent
|
47
47
|
rescue => exception
|
48
48
|
Webdrone.report_error(@a0, exception)
|
49
49
|
end
|
50
50
|
|
51
|
-
def option(text, n: 1, all: false, visible: true)
|
52
|
-
self.xpath XPath::HTML.option(text).to_s, n: n, all: all, visible: visible
|
51
|
+
def option(text, n: 1, all: false, visible: true, parent: nil)
|
52
|
+
self.xpath XPath::HTML.option(text).to_s, n: n, all: all, visible: visible, parent: parent
|
53
53
|
rescue => exception
|
54
54
|
Webdrone.report_error(@a0, exception)
|
55
55
|
end
|
56
56
|
|
57
|
-
def xpath(text, n: 1, all: false, visible: true)
|
57
|
+
def xpath(text, n: 1, all: false, visible: true, parent: nil)
|
58
58
|
@a0.wait.for do
|
59
|
-
items = @a0.driver.find_elements :xpath, text
|
59
|
+
items = (parent || @a0.driver).find_elements :xpath, text
|
60
60
|
choose(items, n, all, visible)
|
61
61
|
end
|
62
62
|
rescue => exception
|
data/lib/webdrone/form.rb
CHANGED
@@ -65,7 +65,7 @@ module Webdrone
|
|
65
65
|
x = heads.shift
|
66
66
|
x ||= name
|
67
67
|
worksheet.add_cell 0, 0, x
|
68
|
-
|
68
|
+
|
69
69
|
heads += data.keys.sort
|
70
70
|
heads = heads.uniq
|
71
71
|
|
@@ -87,8 +87,8 @@ module Webdrone
|
|
87
87
|
@data = prev
|
88
88
|
end
|
89
89
|
|
90
|
-
def set(key, val, n: 1, visible: true)
|
91
|
-
item = self.find_item(key, n: n, visible: visible)
|
90
|
+
def set(key, val, n: 1, visible: true, parent: nil)
|
91
|
+
item = self.find_item(key, n: n, visible: visible, parent: parent)
|
92
92
|
if item.tag_name == 'select'
|
93
93
|
option = item.find_element :xpath, XPath::HTML.option(val).to_s
|
94
94
|
option.click
|
@@ -102,26 +102,26 @@ module Webdrone
|
|
102
102
|
Webdrone.report_error(@a0, exception)
|
103
103
|
end
|
104
104
|
|
105
|
-
def get(key, n: 1, visible: true)
|
106
|
-
self.find_item(key, n: n, visible: visible)[:value]
|
105
|
+
def get(key, n: 1, visible: true, parent: nil)
|
106
|
+
self.find_item(key, n: n, visible: visible, parent: parent)[:value]
|
107
107
|
rescue => exception
|
108
108
|
Webdrone.report_error(@a0, exception)
|
109
109
|
end
|
110
110
|
|
111
|
-
def clic(key, n: 1, visible: true)
|
112
|
-
self.find_item(key, n: n, visible: visible).click
|
111
|
+
def clic(key, n: 1, visible: true, parent: nil)
|
112
|
+
self.find_item(key, n: n, visible: visible, parent: parent).click
|
113
113
|
rescue => exception
|
114
114
|
Webdrone.report_error(@a0, exception)
|
115
115
|
end
|
116
116
|
|
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
|
117
|
+
def mark(key, n: 1, visible: true, parent: nil, color: '#af1616', times: nil, delay: nil, shot: nil)
|
118
|
+
@a0.mark.mark_item self.find_item(key, n: n, visible: visible, parent: parent), color: color, times: times, delay: delay, shot: shot
|
119
119
|
rescue => exception
|
120
120
|
Webdrone.report_error(@a0, exception)
|
121
121
|
end
|
122
122
|
|
123
|
-
def submit(key = nil, n: 1, visible: true)
|
124
|
-
self.find_item(key, n: n, visible: visible) if key
|
123
|
+
def submit(key = nil, n: 1, visible: true, parent: nil)
|
124
|
+
self.find_item(key, n: n, visible: visible, parent: parent) if key
|
125
125
|
@lastitem.submit
|
126
126
|
rescue => exception
|
127
127
|
Webdrone.report_error(@a0, exception)
|
@@ -136,13 +136,13 @@ module Webdrone
|
|
136
136
|
end
|
137
137
|
|
138
138
|
protected
|
139
|
-
def find_item(key, n: 1, visible: true)
|
139
|
+
def find_item(key, n: 1, visible: true, parent: nil)
|
140
140
|
if @xpath.respond_to? :call
|
141
|
-
@lastitem = @a0.find.xpath @xpath.call(key).to_s, n: n, visible: visible
|
141
|
+
@lastitem = @a0.find.xpath @xpath.call(key).to_s, n: n, visible: visible, parent: parent
|
142
142
|
elsif @xpath.is_a? String and @xpath.include? '%s'
|
143
|
-
@lastitem = @a0.find.xpath sprintf(@xpath, key), n: n, visible: visible
|
143
|
+
@lastitem = @a0.find.xpath sprintf(@xpath, key), n: n, visible: visible, parent: parent
|
144
144
|
else
|
145
|
-
@lastitem = @a0.find.xpath XPath::HTML.field(key).to_s, n: n, visible: visible
|
145
|
+
@lastitem = @a0.find.xpath XPath::HTML.field(key).to_s, n: n, visible: visible, parent: parent
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
data/lib/webdrone/html.rb
CHANGED
@@ -12,8 +12,8 @@ module Webdrone
|
|
12
12
|
@a0 = a0
|
13
13
|
end
|
14
14
|
|
15
|
-
def find_html(text, n: 1, all: false, visible: true)
|
16
|
-
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
15
|
+
def find_html(text, n: 1, all: false, visible: true, parent: nil)
|
16
|
+
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, parent: parent
|
17
17
|
if item.is_a? Array
|
18
18
|
item.collect { |x| x.attribute 'innerHTML'}
|
19
19
|
else
|
data/lib/webdrone/mark.rb
CHANGED
@@ -14,8 +14,8 @@ module Webdrone
|
|
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, delay: nil, shot: nil)
|
18
|
-
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
17
|
+
def mark(text, n: 1, all: false, visible: true, parent: nil, color: '#af1616', times: nil, delay: nil, shot: nil)
|
18
|
+
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, parent: parent
|
19
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)
|
data/lib/webdrone/text.rb
CHANGED
@@ -12,8 +12,8 @@ module Webdrone
|
|
12
12
|
@a0 = a0
|
13
13
|
end
|
14
14
|
|
15
|
-
def text(text, n: 1, all: false, visible: true)
|
16
|
-
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
15
|
+
def text(text, n: 1, all: false, visible: true, parent: nil)
|
16
|
+
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, parent: parent
|
17
17
|
if item.is_a? Array
|
18
18
|
item.collect(&:text)
|
19
19
|
else
|
@@ -30,7 +30,7 @@ module Webdrone
|
|
30
30
|
alias_method :on, :text
|
31
31
|
alias_method :option, :text
|
32
32
|
alias_method :xpath, :text
|
33
|
-
|
33
|
+
|
34
34
|
def page_title
|
35
35
|
@a0.driver.title
|
36
36
|
rescue => exception
|
data/lib/webdrone/version.rb
CHANGED
data/lib/webdrone/vrfy.rb
CHANGED
@@ -12,8 +12,8 @@ module Webdrone
|
|
12
12
|
@a0 = a0
|
13
13
|
end
|
14
14
|
|
15
|
-
def vrfy(text, n: 1, all: false, visible: true, attr: nil, eq: nil, contains: nil)
|
16
|
-
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
|
15
|
+
def vrfy(text, n: 1, all: false, visible: true, parent: nil, attr: nil, eq: nil, contains: nil)
|
16
|
+
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, parent: parent
|
17
17
|
if item.is_a? Array
|
18
18
|
item.each { |x| vrfy_item x, text: text, callee: __callee__, attr: attr, eq: eq, contains: contains }
|
19
19
|
else
|
data/webdrone.gemspec
CHANGED
@@ -27,13 +27,13 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.
|
31
|
-
spec.add_development_dependency "rake", "~> 10.
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.5"
|
32
32
|
spec.add_development_dependency "rspec"
|
33
33
|
spec.add_development_dependency "ci_reporter_rspec"
|
34
34
|
spec.add_development_dependency "parallel_tests"
|
35
35
|
spec.add_runtime_dependency "os"
|
36
|
-
spec.add_runtime_dependency "selenium-webdriver"
|
36
|
+
spec.add_runtime_dependency "selenium-webdriver", ">= 3.5.0"
|
37
37
|
spec.add_runtime_dependency "xpath"
|
38
38
|
spec.add_runtime_dependency "rubyXL"
|
39
39
|
spec.add_runtime_dependency "binding_of_caller"
|
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.7.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: 2017-
|
11
|
+
date: 2017-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.15'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '10.
|
33
|
+
version: '10.5'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '10.
|
40
|
+
version: '10.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 3.5.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 3.5.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: xpath
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.6.11
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: A simple selenium webdriver wrapper, ruby version.
|