async-webdriver 0.7.0 → 0.9.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
- checksums.yaml.gz.sig +0 -0
- data/lib/async/webdriver/bridge/pool.rb +5 -0
- data/lib/async/webdriver/element.rb +2 -2
- data/lib/async/webdriver/error.rb +29 -29
- data/lib/async/webdriver/request_helper.rb +5 -3
- data/lib/async/webdriver/scope/fields.rb +6 -1
- data/lib/async/webdriver/scope/screen_capture.rb +1 -1
- data/lib/async/webdriver/version.rb +1 -1
- data/readme.md +15 -0
- data/releases.md +10 -0
- data.tar.gz.sig +0 -0
- metadata +5 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe93050116a6c87ff0cdb48231966242d1c99e2bab1b773f455ff2d0fdda5a87
|
4
|
+
data.tar.gz: 25977c570eb1235fadf1eee31a2e42c1fc97f98b7ccd9759aea46959b6fd82ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a433e7bd71265ef9e65097cdac2d19b966ac3c7ddabf2cbe02b64ffc17367fcfb9218aac5cfcd230ed481c819b0bed34ed91c8238e445cc426c6b219a64e5f8
|
7
|
+
data.tar.gz: 8e762c8be4bf92aab638d38c047d8644a29a9e856256717eb6153ff6b8e1efc563f36fe6267ad6a8a2bf0a9a4c1521de1387249f00fab74da6987287609dbd16
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -71,6 +71,11 @@ module Async
|
|
71
71
|
def acquire
|
72
72
|
if @sessions.empty?
|
73
73
|
session = @client.post("session", {capabilities: @capabilities})
|
74
|
+
|
75
|
+
if session.nil?
|
76
|
+
raise Async::WebDriver::Error, "Failed to create session with capabilities: #{@capabilities.inspect}"
|
77
|
+
end
|
78
|
+
|
74
79
|
session[:cache] = self
|
75
80
|
session[:endpoint] = @driver.endpoint
|
76
81
|
|
@@ -211,9 +211,9 @@ module Async
|
|
211
211
|
# element.tagName
|
212
212
|
# ```
|
213
213
|
#
|
214
|
-
# @returns [String] The tag name of the element.
|
214
|
+
# @returns [String] The tag name of the element, always in lowercase for consistency across browsers.
|
215
215
|
def tag_name
|
216
|
-
get("name")
|
216
|
+
get("name").downcase
|
217
217
|
end
|
218
218
|
|
219
219
|
# A struct representing the size of an element.
|
@@ -9,147 +9,147 @@ module Async
|
|
9
9
|
module WebDriver
|
10
10
|
class Error < StandardError
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
# The Element Click command could not be completed because the element receiving the events is obscuring the element that was requested clicked.
|
14
14
|
class ElementClickInterceptedError < Error
|
15
15
|
CODE = "element click intercepted"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
# A command could not be completed because the element is not pointer- or keyboard interactable.
|
19
19
|
class ElementNotInteractableError < Error
|
20
20
|
CODE = "element not interactable"
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
# Navigation caused the user agent to hit a certificate warning, which is usually the result of an expired or invalid TLS certificate.
|
24
24
|
class InsecureCertificateError < Error
|
25
25
|
CODE = "insecure certificate"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
# The arguments passed to a command are either invalid or malformed.
|
29
29
|
class InvalidArgumentError < Error
|
30
30
|
CODE = "invalid argument"
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# An illegal attempt was made to set a cookie under a different domain than the current page.
|
34
34
|
class InvalidCookieDomainError < Error
|
35
35
|
CODE = "invalid cookie domain"
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# A command could not be completed because the element is in an invalid state, e.g. attempting to clear an element that isn’t both editable and resettable.
|
39
39
|
class InvalidElementStateError < Error
|
40
40
|
CODE = "invalid element state"
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
# Argument was an invalid selector.
|
44
44
|
class InvalidSelectorError < Error
|
45
45
|
CODE = "invalid selector"
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
# Occurs if the given session id is not in the list of active sessions, meaning the session either does not exist or that it’s not active.
|
49
49
|
class InvalidSessionIdError < Error
|
50
50
|
CODE = "invalid session id"
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
# An error occurred while executing JavaScript supplied by the user.
|
54
54
|
class JavaScriptError < Error
|
55
55
|
CODE = "javascript error"
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
# The target for mouse interaction is not in the browser’s viewport and cannot be brought into that viewport.
|
59
59
|
class MoveTargetOutOfBoundsError < Error
|
60
60
|
CODE = "move target out of bounds"
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
# An attempt was made to operate on a modal dialog when one was not open.
|
64
64
|
class NoSuchAlertError < Error
|
65
65
|
CODE = "no such alert"
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
# No cookie matching the given path name was found amongst the associated cookies of the current browsing context’s active document.
|
69
69
|
class NoSuchCookieError < Error
|
70
70
|
CODE = "no such cookie"
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
# An element could not be located on the page using the given search parameters.
|
74
74
|
class NoSuchElementError < Error
|
75
75
|
CODE = "no such element"
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
# A command to switch to a frame could not be satisfied because the frame could not be found.
|
79
79
|
class NoSuchFrameError < Error
|
80
80
|
CODE = "no such frame"
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
# A command to switch to a window could not be satisfied because the window could not be found.
|
84
84
|
class NoSuchWindowError < Error
|
85
85
|
CODE = "no such window"
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
# The element does not have a shadow root.
|
89
89
|
class NoSuchShadowRootError < Error
|
90
90
|
CODE = "no such shadow root"
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
# A script did not complete before its timeout expired.
|
94
94
|
class ScriptTimeoutError < Error
|
95
95
|
CODE = "script timeout error"
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
# A new session could not be created.
|
99
99
|
class SessionNotCreatedError < Error
|
100
100
|
CODE = "session not created"
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
# A command failed because the referenced element is no longer attached to the DOM.
|
104
104
|
class StaleElementReferenceError < Error
|
105
105
|
CODE = "stale element reference"
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
# A command failed because the referenced shadow root is no longer attached to the DOM.
|
109
109
|
class DetachedShadowRootError < Error
|
110
110
|
CODE = "detached shadow root"
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
# An operation did not complete before its timeout expired.
|
114
114
|
class TimeoutError < Error
|
115
115
|
CODE = "timeout"
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
# A command to set a cookie’s value could not be satisfied.
|
119
119
|
class UnableToSetCookieError < Error
|
120
120
|
CODE = "unable to set cookie"
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
# A screen capture was made impossible.
|
124
124
|
class UnableToCaptureScreenError < Error
|
125
125
|
CODE = "unable to capture screen"
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
# A modal dialog was open, blocking this operation.
|
129
129
|
class UnexpectedAlertOpenError < Error
|
130
130
|
CODE = "unexpected alert open"
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
# A command could not be executed because the remote end is not aware of it.
|
134
134
|
class UnknownCommandError < Error
|
135
135
|
CODE = "unknown command"
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
# An unknown error occurred in the remote end while processing the command.
|
139
139
|
class UnknownError < Error
|
140
140
|
CODE = "unknown error"
|
141
141
|
end
|
142
|
-
|
142
|
+
|
143
143
|
# The requested command matched a known URL but did not match any method for that URL.
|
144
144
|
class UnknownMethodError < Error
|
145
145
|
CODE = "unknown method"
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
# Indicates that a command that should have executed properly cannot be supported for some reason.
|
149
149
|
class UnsupportedOperationError < Error
|
150
150
|
CODE = "unsupported operation"
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
ERROR_CODES = {
|
154
154
|
ElementClickInterceptedError::CODE => ElementClickInterceptedError,
|
155
155
|
ElementNotInteractableError::CODE => ElementNotInteractableError,
|
@@ -46,10 +46,10 @@ module Async
|
|
46
46
|
# @returns [Object] The unwrapped value.
|
47
47
|
def unwrap_object(value)
|
48
48
|
if value.is_a?(Hash) and value.key?(ELEMENT_KEY)
|
49
|
-
Element.new(self.session, value[ELEMENT_KEY])
|
50
|
-
else
|
51
|
-
value
|
49
|
+
value = Element.new(self.session, value[ELEMENT_KEY])
|
52
50
|
end
|
51
|
+
|
52
|
+
return value
|
53
53
|
end
|
54
54
|
|
55
55
|
# Used by `JSON.load` to unwrap objects.
|
@@ -60,6 +60,8 @@ module Async
|
|
60
60
|
when Array
|
61
61
|
value.map!(&method(:unwrap_object))
|
62
62
|
end
|
63
|
+
|
64
|
+
return value
|
63
65
|
end
|
64
66
|
|
65
67
|
# Extract the value from the reply.
|
@@ -32,7 +32,12 @@ module Async
|
|
32
32
|
element.clear
|
33
33
|
end
|
34
34
|
|
35
|
-
element.
|
35
|
+
if element.tag_name == "select"
|
36
|
+
option = element.find_element_by_xpath(".//option[text()=#{XPath::escape(value)}]")
|
37
|
+
option.click unless option.selected?
|
38
|
+
else
|
39
|
+
element.send_keys(value)
|
40
|
+
end
|
36
41
|
end
|
37
42
|
|
38
43
|
# Click a button with the given label.
|
@@ -13,7 +13,7 @@ module Async
|
|
13
13
|
# Take a screenshot of the current page or element.
|
14
14
|
# @returns [String] The screenshot as a Base64 encoded string.
|
15
15
|
def screenshot
|
16
|
-
reply = current_scope.
|
16
|
+
reply = current_scope.get("screenshot")
|
17
17
|
|
18
18
|
return Base64.decode64(reply)
|
19
19
|
end
|
data/readme.md
CHANGED
@@ -16,10 +16,25 @@ Please see the [project documentation](https://socketry.github.io/async-webdrive
|
|
16
16
|
|
17
17
|
- [Getting Started](https://socketry.github.io/async-webdriver/guides/getting-started/index) - This guide explains how to use `async-webdriver` for controlling a browser.
|
18
18
|
|
19
|
+
- [Debugging](https://socketry.github.io/async-webdriver/guides/debugging/index) - This guide explains how to debug WebDriver issues by capturing HTML source and screenshots when tests fail.
|
20
|
+
|
19
21
|
- [GitHub Actions Integrations](https://socketry.github.io/async-webdriver/guides/github-actions-integration/index) - This guide explains how to use `async-webdriver` with GitHub Actions.
|
20
22
|
|
21
23
|
- [Sus Integration](https://socketry.github.io/async-webdriver/guides/sus-integration/index) - This guide will show you how to integrate `async-webdriver` with the sus test framework.
|
22
24
|
|
25
|
+
## Releases
|
26
|
+
|
27
|
+
Please see the [project releases](https://socketry.github.io/async-webdriver/releases/index) for all releases.
|
28
|
+
|
29
|
+
### v0.9.0
|
30
|
+
|
31
|
+
- Fix `Scope#screenshot` to use the correct HTTP method (`GET` instead of `POST`).
|
32
|
+
|
33
|
+
### v0.8.0
|
34
|
+
|
35
|
+
- Fix `fill_in` `<select>` on Safari.
|
36
|
+
- `Element#tag_name` now normalizes the tag name to lowercase (Safari returns uppercase while other browsers return lowercase).
|
37
|
+
|
23
38
|
## See Also
|
24
39
|
|
25
40
|
- [sus-fixtures-async-webdriver](https://github.com/socketry/sus-fixtures-async-webdriver) - Standard fixtures for testing web applications with `async-webdriver`.
|
data/releases.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Releases
|
2
|
+
|
3
|
+
## v0.9.0
|
4
|
+
|
5
|
+
- Fix `Scope#screenshot` to use the correct HTTP method (`GET` instead of `POST`).
|
6
|
+
|
7
|
+
## v0.8.0
|
8
|
+
|
9
|
+
- Fix `fill_in` `<select>` on Safari.
|
10
|
+
- `Element#tag_name` now normalizes the tag name to lowercase (Safari returns uppercase while other browsers return lowercase).
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
37
37
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-actor
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/async/webdriver/xpath.rb
|
143
143
|
- license.md
|
144
144
|
- readme.md
|
145
|
+
- releases.md
|
145
146
|
homepage: https://github.com/socketry/async-webdriver
|
146
147
|
licenses:
|
147
148
|
- MIT
|
@@ -156,14 +157,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
157
|
requirements:
|
157
158
|
- - ">="
|
158
159
|
- !ruby/object:Gem::Version
|
159
|
-
version: '3.
|
160
|
+
version: '3.2'
|
160
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
162
|
requirements:
|
162
163
|
- - ">="
|
163
164
|
- !ruby/object:Gem::Version
|
164
165
|
version: '0'
|
165
166
|
requirements: []
|
166
|
-
rubygems_version: 3.6.
|
167
|
+
rubygems_version: 3.6.9
|
167
168
|
specification_version: 4
|
168
169
|
summary: A native library implementing the W3C WebDriver client specification.
|
169
170
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|