async-webdriver 0.4.0 → 0.6.0
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/async/webdriver/bridge/chrome.rb +2 -2
- data/lib/async/webdriver/bridge/firefox.rb +2 -2
- data/lib/async/webdriver/bridge/generic.rb +5 -1
- data/lib/async/webdriver/bridge/safari.rb +84 -0
- data/lib/async/webdriver/bridge.rb +17 -4
- data/lib/async/webdriver/locator.rb +0 -2
- data/lib/async/webdriver/scope/elements.rb +0 -2
- data/lib/async/webdriver/scope/fields.rb +0 -2
- data/lib/async/webdriver/version.rb +1 -1
- data/license.md +1 -1
- data/readme.md +5 -1
- data.tar.gz.sig +0 -0
- metadata +30 -14
- 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: bf43f03c5d84881a589b4b8ada0b4b610bd81d7434b42387986c2e62be565748
|
4
|
+
data.tar.gz: eeeda998354a547586c84f796a74062304510e3778011d18e60bead39ffb9d63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 061ec510b866722f3893e549153532e8053a8aa4301316b338fec0bdd0785d00e7b84257969bfd2622581aecedaf59dd08f375577f051fc64c51ab4411b9fbe0
|
7
|
+
data.tar.gz: 73ef488209fcdff4efb657b3c47b61459de197e9303790ed59356e05c6f7553155971b225d2271987da64e7336d5343aa5de4882bf0610c6d435cad369860c86
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'generic'
|
7
7
|
require_relative 'process_group'
|
@@ -71,7 +71,7 @@ module Async
|
|
71
71
|
# The default capabilities for the Chrome browser which need to be provided when requesting a new session.
|
72
72
|
# @parameter headless [Boolean] Whether to run the browser in headless mode.
|
73
73
|
# @returns [Hash] The default capabilities for the Chrome browser.
|
74
|
-
def default_capabilities(headless:
|
74
|
+
def default_capabilities(headless: self.headless?)
|
75
75
|
{
|
76
76
|
alwaysMatch: {
|
77
77
|
browserName: "chrome",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'generic'
|
7
7
|
require_relative 'process_group'
|
@@ -74,7 +74,7 @@ module Async
|
|
74
74
|
# The default capabilities for the Firefox browser which need to be provided when requesting a new session.
|
75
75
|
# @parameter headless [Boolean] Whether to run the browser in headless mode.
|
76
76
|
# @returns [Hash] The default capabilities for the Firefox browser.
|
77
|
-
def default_capabilities(headless:
|
77
|
+
def default_capabilities(headless: self.headless?)
|
78
78
|
{
|
79
79
|
alwaysMatch: {
|
80
80
|
browserName: "firefox",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'socket'
|
7
7
|
require 'async/http/endpoint'
|
@@ -29,6 +29,10 @@ module Async
|
|
29
29
|
def supported?
|
30
30
|
version != nil
|
31
31
|
end
|
32
|
+
|
33
|
+
def headless?
|
34
|
+
@options.fetch(:headless, true)
|
35
|
+
end
|
32
36
|
end
|
33
37
|
end
|
34
38
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative 'generic'
|
7
|
+
require_relative 'process_group'
|
8
|
+
|
9
|
+
module Async
|
10
|
+
module WebDriver
|
11
|
+
module Bridge
|
12
|
+
# A bridge to the Safari browser using `safaridriver`.
|
13
|
+
#
|
14
|
+
# ``` ruby
|
15
|
+
# begin
|
16
|
+
# bridge = Async::WebDriver::Bridge::Safari.start
|
17
|
+
# client = Async::WebDriver::Client.open(bridge.endpoint)
|
18
|
+
# ensure
|
19
|
+
# bridge&.close
|
20
|
+
# end
|
21
|
+
# ```
|
22
|
+
class Safari < Generic
|
23
|
+
def path
|
24
|
+
@options.fetch(:path, "safaridriver")
|
25
|
+
end
|
26
|
+
|
27
|
+
# @returns [String] The version of the `safaridriver` executable.
|
28
|
+
def version
|
29
|
+
::IO.popen([self.path, "--version"]) do |io|
|
30
|
+
return io.read
|
31
|
+
end
|
32
|
+
rescue Errno::ENOENT
|
33
|
+
return nil
|
34
|
+
end
|
35
|
+
|
36
|
+
class Driver < Bridge::Driver
|
37
|
+
def initialize(**options)
|
38
|
+
super(**options)
|
39
|
+
@process_group = nil
|
40
|
+
end
|
41
|
+
|
42
|
+
# @returns [Array(String)] The arguments to pass to the `safaridriver` executable.
|
43
|
+
def arguments(**options)
|
44
|
+
[
|
45
|
+
options.fetch(:path, "safaridriver"),
|
46
|
+
"--port=#{self.port}",
|
47
|
+
].compact
|
48
|
+
end
|
49
|
+
|
50
|
+
def start
|
51
|
+
@process_group = ProcessGroup.spawn(*arguments(**@options))
|
52
|
+
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
def close
|
57
|
+
if @process_group
|
58
|
+
@process_group.close
|
59
|
+
@process_group = nil
|
60
|
+
end
|
61
|
+
|
62
|
+
super
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Start the driver.
|
67
|
+
def start(**options)
|
68
|
+
Driver.new(**options).tap(&:start)
|
69
|
+
end
|
70
|
+
|
71
|
+
# The default capabilities for the Safari browser which need to be provided when requesting a new session.
|
72
|
+
# @parameter headless [Boolean] Whether to run the browser in headless mode.
|
73
|
+
# @returns [Hash] The default capabilities for the Safari browser.
|
74
|
+
def default_capabilities(headless: self.headless?)
|
75
|
+
{
|
76
|
+
alwaysMatch: {
|
77
|
+
browserName: "safari",
|
78
|
+
},
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'bridge/chrome'
|
7
7
|
require_relative 'bridge/firefox'
|
8
|
+
require_relative 'bridge/safari'
|
8
9
|
|
9
10
|
require_relative 'error'
|
10
11
|
|
@@ -17,6 +18,7 @@ module Async
|
|
17
18
|
ALL = [
|
18
19
|
Bridge::Chrome,
|
19
20
|
Bridge::Firefox,
|
21
|
+
Bridge::Safari,
|
20
22
|
]
|
21
23
|
|
22
24
|
def self.each(&block)
|
@@ -36,16 +38,27 @@ module Async
|
|
36
38
|
# ```
|
37
39
|
ASYNC_WEBDRIVER_BRIDGE = 'ASYNC_WEBDRIVER_BRIDGE'
|
38
40
|
|
41
|
+
# The environment variable used to disable headless mode.
|
42
|
+
#
|
43
|
+
# ```
|
44
|
+
# ASYNC_WEBDRIVER_BRIDGE_HEADLESS=false
|
45
|
+
# ```
|
46
|
+
ASYNC_WEBDRIVER_BRIDGE_HEADLESS = 'ASYNC_WEBDRIVER_BRIDGE_HEADLESS'
|
47
|
+
|
39
48
|
class UnsupportedError < Error
|
40
49
|
end
|
41
50
|
|
42
51
|
# @returns [Bridge] The default bridge to use.
|
43
|
-
def self.default(env = ENV)
|
52
|
+
def self.default(env = ENV, **options)
|
53
|
+
if env[ASYNC_WEBDRIVER_BRIDGE_HEADLESS] == "false"
|
54
|
+
options[:headless] = false
|
55
|
+
end
|
56
|
+
|
44
57
|
if name = env[ASYNC_WEBDRIVER_BRIDGE]
|
45
|
-
self.const_get(name).
|
58
|
+
self.const_get(name).mew(**options)
|
46
59
|
else
|
47
60
|
ALL.each do |klass|
|
48
|
-
instance = klass.new
|
61
|
+
instance = klass.new(**options)
|
49
62
|
return instance if instance.supported?
|
50
63
|
end
|
51
64
|
|
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -18,6 +18,10 @@ Please see the [project documentation](https://socketry.github.io/async-webdrive
|
|
18
18
|
|
19
19
|
- [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
20
|
|
21
|
+
## See Also
|
22
|
+
|
23
|
+
- [sus-fixtures-async-webdriver](https://github.com/socketry/sus-fixtures-async-webdriver) - STandard fixtures for testing web applications with `async-webdriver`.
|
24
|
+
|
21
25
|
## Contributing
|
22
26
|
|
23
27
|
We welcome contributions to this project.
|
@@ -34,4 +38,4 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
|
|
34
38
|
|
35
39
|
### Contributor Covenant
|
36
40
|
|
37
|
-
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
41
|
+
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -37,8 +37,22 @@ cert_chain:
|
|
37
37
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
38
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date:
|
40
|
+
date: 2024-05-04 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: async-actor
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.1'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.1'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: async-http
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,47 +68,47 @@ dependencies:
|
|
54
68
|
- !ruby/object:Gem::Version
|
55
69
|
version: '0.61'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
|
-
name: async-
|
71
|
+
name: async-pool
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
76
|
+
version: '0.4'
|
63
77
|
type: :runtime
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0.
|
83
|
+
version: '0.4'
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
|
-
name: async-
|
85
|
+
name: async-websocket
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
88
|
- - "~>"
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0.
|
90
|
+
version: '0.25'
|
77
91
|
type: :runtime
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
95
|
- - "~>"
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0.
|
97
|
+
version: '0.25'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
99
|
+
name: base64
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
87
101
|
requirements:
|
88
102
|
- - "~>"
|
89
103
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0.
|
104
|
+
version: '0.2'
|
91
105
|
type: :runtime
|
92
106
|
prerelease: false
|
93
107
|
version_requirements: !ruby/object:Gem::Requirement
|
94
108
|
requirements:
|
95
109
|
- - "~>"
|
96
110
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
111
|
+
version: '0.2'
|
98
112
|
description:
|
99
113
|
email:
|
100
114
|
executables: []
|
@@ -109,6 +123,7 @@ files:
|
|
109
123
|
- lib/async/webdriver/bridge/generic.rb
|
110
124
|
- lib/async/webdriver/bridge/pool.rb
|
111
125
|
- lib/async/webdriver/bridge/process_group.rb
|
126
|
+
- lib/async/webdriver/bridge/safari.rb
|
112
127
|
- lib/async/webdriver/client.rb
|
113
128
|
- lib/async/webdriver/element.rb
|
114
129
|
- lib/async/webdriver/error.rb
|
@@ -130,12 +145,13 @@ files:
|
|
130
145
|
- lib/async/webdriver/xpath.rb
|
131
146
|
- license.md
|
132
147
|
- readme.md
|
133
|
-
homepage: https://github.com/socketry/async-webdriver
|
148
|
+
homepage: https://github.com/socketry/async-webdriver
|
134
149
|
licenses:
|
135
150
|
- MIT
|
136
151
|
metadata:
|
137
152
|
documentation_uri: https://socketry.github.io/async-webdriver/
|
138
153
|
funding_uri: https://github.com/sponsors/ioquatix
|
154
|
+
source_code_uri: https://github.com/socketry/async-webdriver.git
|
139
155
|
post_install_message:
|
140
156
|
rdoc_options: []
|
141
157
|
require_paths:
|
@@ -144,14 +160,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
160
|
requirements:
|
145
161
|
- - ">="
|
146
162
|
- !ruby/object:Gem::Version
|
147
|
-
version: '3.
|
163
|
+
version: '3.1'
|
148
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
165
|
requirements:
|
150
166
|
- - ">="
|
151
167
|
- !ruby/object:Gem::Version
|
152
168
|
version: '0'
|
153
169
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
170
|
+
rubygems_version: 3.5.3
|
155
171
|
signing_key:
|
156
172
|
specification_version: 4
|
157
173
|
summary: A native library implementing the W3C WebDriver client specification.
|
metadata.gz.sig
CHANGED
Binary file
|