dvla-browser-drivers 3.0.1 → 3.1.1
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 +12 -0
- data/Gemfile +3 -3
- data/README.md +15 -2
- data/lib/dvla/browser/drivers/meta_drivers.rb +28 -20
- data/lib/dvla/browser/drivers/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: daf0b2353940798a5c9d36c7fe913b589cad89b791a5a6b74a83cbb847bcb37f
|
|
4
|
+
data.tar.gz: 5790a89b0c71afca0797d5cc3ee29f01dcc7bef948bae61f0e49861b8acbd632
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d167bcc8ea2d475d5e4ff3eb9e742c033bc4f3a5b85d3fd61a89df9c3d3c1136c287bc94ef1e13be850e254b23b002ea125592aeb95830a5c6e9ec0e78e685ba
|
|
7
|
+
data.tar.gz: a8b00343b366ff71c176634ffa7069a22cf0a0034ee4b0ca2d0aa2fcb7777876c6becb91d113e2a1f8d6a15a7e4be622ab554386d9ec06f8ec446adae8060eab
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
# [3.1.1] - 2025-12-12
|
|
5
|
+
|
|
6
|
+
- Add selenium_safari config
|
|
7
|
+
- Add optional binary string for Selenium
|
|
8
|
+
|
|
9
|
+
# [3.1.0] - 2025-12-10
|
|
10
|
+
|
|
11
|
+
- Add websocket URL to enable BiDi functionality via Selenium
|
|
12
|
+
- Added a changelog
|
data/Gemfile
CHANGED
|
@@ -5,10 +5,10 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in dvla-browser-drivers.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem 'bundler-audit', '~> 0.9'
|
|
8
|
+
gem 'bundler-audit', '~> 0.9.3'
|
|
9
9
|
gem 'dvla-lint', '~> 1.7'
|
|
10
10
|
gem 'pry', '~> 0.14'
|
|
11
|
-
gem 'rake', '~> 13.
|
|
12
|
-
gem 'rspec', '~> 3.
|
|
11
|
+
gem 'rake', '~> 13.3'
|
|
12
|
+
gem 'rspec', '~> 3.13'
|
|
13
13
|
gem 'simplecov', '~> 0.22'
|
|
14
14
|
gem 'simplecov-console', '~> 0.9'
|
data/README.md
CHANGED
|
@@ -29,10 +29,10 @@ Once installed, you are able to use any pre-configured browser driver from the l
|
|
|
29
29
|
|---------------------------|----------------------------------------------------|
|
|
30
30
|
| selenium_chrome | `DVLA::Browser::Drivers.selenium_chrome` |
|
|
31
31
|
| headless_selenium_chrome | `DVLA::Browser::Drivers.headless_selenium_chrome` |
|
|
32
|
-
| selenium_edge | `DVLA::Browser::Drivers.selenium_edge` |
|
|
33
|
-
| headless_selenium_edge | `DVLA::Browser::Drivers.headless_selenium_edge` |
|
|
34
32
|
| selenium_firefox | `DVLA::Browser::Drivers.selenium_firefox` |
|
|
35
33
|
| headless_selenium_firefox | `DVLA::Browser::Drivers.headless_selenium_firefox` |
|
|
34
|
+
| selenium_edge | `DVLA::Browser::Drivers.selenium_edge` |
|
|
35
|
+
| selenium_safari | `DVLA::Browser::Drivers.selenium_safari` |
|
|
36
36
|
|
|
37
37
|
### Non-selenium drivers
|
|
38
38
|
|
|
@@ -43,6 +43,8 @@ Once installed, you are able to use any pre-configured browser driver from the l
|
|
|
43
43
|
| apparition | `DVLA::Browser::Drivers.apparition` |
|
|
44
44
|
| headless_apparition | `DVLA::Browser::Drivers.headless_apparition` |
|
|
45
45
|
|
|
46
|
+
**Note:** Safari and Edge do not support headless mode.
|
|
47
|
+
|
|
46
48
|
---
|
|
47
49
|
|
|
48
50
|
### Default configuration
|
|
@@ -71,6 +73,17 @@ Once installed, you are able to use any pre-configured browser driver from the l
|
|
|
71
73
|
| save_path | Cuprite, Apparition | `cuprite(save_path: 'File.expand_path('./somewhere')' )` | Tells the browser where to store downloads |
|
|
72
74
|
| browser_options | Cuprite, Apparition | `cuprite(browser_options: { option: value, option: value })` | Pass additional options to the browser |
|
|
73
75
|
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### BiDi Support
|
|
79
|
+
|
|
80
|
+
BiDi (Bidirectional Protocol) is enabled by default on all Selenium drivers (Chrome, Firefox, Edge). This allows bidirectional communication between the driver and browser.
|
|
81
|
+
It is still in active development so breaking changes are expected. Check the documentation for the latest implementation guides:
|
|
82
|
+
|
|
83
|
+
* [Selenium docs](https://www.selenium.dev/documentation/webdriver/bidi/)
|
|
84
|
+
* [W3C specification](https://w3c.github.io/webdriver-bidi/)
|
|
85
|
+
|
|
86
|
+
|
|
74
87
|
## Development
|
|
75
88
|
|
|
76
89
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module DVLA
|
|
2
2
|
module Browser
|
|
3
3
|
module Drivers
|
|
4
|
-
DRIVER_REGEX = /^(?:(?<headless>
|
|
4
|
+
DRIVER_REGEX = /^(?:(?<headless>headless_)(?<driver>selenium_(?<browser>chrome|firefox)|cuprite|apparition)|(?<driver_no_headless>selenium_(?<browser_no_headless>chrome|firefox|edge|safari)|cuprite|apparition))$/
|
|
5
5
|
|
|
6
6
|
OTHER_ACCEPTED_PARAMS = %i[timeout browser_options save_path remote].freeze
|
|
7
7
|
OTHER_DRIVERS = %i[cuprite apparition].freeze
|
|
8
|
-
SELENIUM_ACCEPTED_PARAMS = %i[remote additional_arguments additional_preferences].freeze
|
|
9
|
-
SELENIUM_DRIVERS = %i[selenium_chrome selenium_firefox selenium_edge].freeze
|
|
8
|
+
SELENIUM_ACCEPTED_PARAMS = %i[remote additional_arguments additional_preferences binary].freeze
|
|
9
|
+
SELENIUM_DRIVERS = %i[selenium_chrome selenium_firefox selenium_edge selenium_safari].freeze
|
|
10
10
|
|
|
11
11
|
# Creates methods in the Drivers module that matches the DRIVER_REGEX
|
|
12
12
|
# These methods will register a Driver for use by Capybara in a test pack
|
|
@@ -19,38 +19,46 @@ module DVLA
|
|
|
19
19
|
def self.method_missing(method, *args, **kwargs, &)
|
|
20
20
|
if (matches = method.match(DRIVER_REGEX))
|
|
21
21
|
headless = matches[:headless].is_a? String
|
|
22
|
-
driver = matches[:driver]
|
|
22
|
+
driver = matches[:driver]&.to_sym || matches[:driver_no_headless]&.to_sym
|
|
23
|
+
browser_match = matches[:browser] || matches[:browser_no_headless]
|
|
23
24
|
|
|
24
25
|
case driver
|
|
25
26
|
when *SELENIUM_DRIVERS
|
|
26
|
-
browser =
|
|
27
|
+
browser = browser_match.to_sym
|
|
27
28
|
|
|
28
29
|
kwargs.each do |key, _value|
|
|
29
30
|
LOG.warn { "Key: '#{key}' will be ignored | Use one from: '#{SELENIUM_ACCEPTED_PARAMS}'" } unless SELENIUM_ACCEPTED_PARAMS.include?(key)
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
::Capybara.register_driver method do |app|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
if browser == :safari
|
|
35
|
+
options = Selenium::WebDriver::Safari::Options.new
|
|
36
|
+
else
|
|
37
|
+
options = Object.const_get("Selenium::WebDriver::#{browser.to_s.capitalize}::Options").new(web_socket_url: true)
|
|
38
|
+
options.binary = kwargs[:binary] if kwargs[:binary]
|
|
39
|
+
options.add_argument('--disable-dev-shm-usage')
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
if headless
|
|
42
|
+
options.add_argument('--headless')
|
|
43
|
+
options.add_argument('--no-sandbox')
|
|
44
|
+
end
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
kwargs[:additional_arguments] && kwargs[:additional_arguments].each do |argument|
|
|
47
|
+
argument.prepend('--') unless argument.start_with?('--')
|
|
48
|
+
options.add_argument(argument)
|
|
49
|
+
end
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
kwargs[:additional_preferences] && kwargs[:additional_preferences].each do |preference|
|
|
52
|
+
key, value = preference.first
|
|
53
|
+
options.add_preference(key, value)
|
|
54
|
+
end
|
|
46
55
|
end
|
|
47
56
|
|
|
48
|
-
kwargs[:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
end
|
|
57
|
+
driver_browser = kwargs[:remote] ? :remote : browser
|
|
58
|
+
driver_options = { browser: driver_browser, options: }
|
|
59
|
+
driver_options[:url] = kwargs[:remote] if kwargs[:remote]
|
|
52
60
|
|
|
53
|
-
::Capybara::Selenium::Driver.new(app,
|
|
61
|
+
::Capybara::Selenium::Driver.new(app, **driver_options)
|
|
54
62
|
end
|
|
55
63
|
else
|
|
56
64
|
kwargs.each do |key, _value|
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dvla-browser-drivers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Driver and Vehicle Licensing Agency (DVLA)
|
|
8
8
|
- Tomos Griffiths
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2025-12-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: apparition
|
|
@@ -92,6 +92,7 @@ extensions: []
|
|
|
92
92
|
extra_rdoc_files: []
|
|
93
93
|
files:
|
|
94
94
|
- ".ruby-version"
|
|
95
|
+
- CHANGELOG.md
|
|
95
96
|
- Gemfile
|
|
96
97
|
- README.md
|
|
97
98
|
- bin/console
|
|
@@ -106,7 +107,7 @@ licenses:
|
|
|
106
107
|
metadata:
|
|
107
108
|
homepage_uri: https://github.com/dvla/dvla-browser-drivers
|
|
108
109
|
source_code_uri: https://github.com/dvla/dvla-browser-drivers
|
|
109
|
-
post_install_message:
|
|
110
|
+
post_install_message:
|
|
110
111
|
rdoc_options: []
|
|
111
112
|
require_paths:
|
|
112
113
|
- lib
|
|
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
123
|
version: '0'
|
|
123
124
|
requirements: []
|
|
124
125
|
rubygems_version: 3.5.3
|
|
125
|
-
signing_key:
|
|
126
|
+
signing_key:
|
|
126
127
|
specification_version: 4
|
|
127
128
|
summary: Browser-drivers has pre-configured web-browser drivers that can be used out-of-the-box
|
|
128
129
|
for the development of UI based applications.
|