dvla-browser-drivers 3.0.0 → 3.1.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 +8 -0
- data/Gemfile +3 -3
- data/README.md +24 -6
- data/lib/dvla/browser/drivers/meta_drivers.rb +16 -5
- 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: ac07160d1bc1d37efd9b23fca6eb49e7b591c63394322b7c2bd1c65328568523
|
|
4
|
+
data.tar.gz: baaf5af95ef7185e130b5f6ae6ef1d4b00620b18d0a2490607aaa5e8a460a566
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 109149e21784a203260a5c0bed209b53cfe998f4fb71ae5199a8aa605e2e4455b5d09ac574e8f8ffb33974dd76f9fa99c73768a2db6e3a5fed319c9854f43e4c
|
|
7
|
+
data.tar.gz: 7a795f13005830a63ecbd8c780a474798626eaf3dbaee5b5ca33a3bb572000fd18c8f517e727abd538cab21cc5cd861cf2c3c49b3dde5ac0ab7337af2b7548b8
|
data/CHANGELOG.md
ADDED
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
|
@@ -47,6 +47,8 @@ Once installed, you are able to use any pre-configured browser driver from the l
|
|
|
47
47
|
|
|
48
48
|
### Default configuration
|
|
49
49
|
|
|
50
|
+
[Chromium switches](https://peter.sh/experiments/chromium-command-line-switches/)
|
|
51
|
+
|
|
50
52
|
| Driver | Configuration |
|
|
51
53
|
|--------------------------------------------------|-------------------------------------------------------|
|
|
52
54
|
| selenium_chrome, selenium_edge, selenium_firefox | --disable-dev-shm-usage<br/> |
|
|
@@ -57,12 +59,28 @@ Once installed, you are able to use any pre-configured browser driver from the l
|
|
|
57
59
|
|
|
58
60
|
### Additional configuration
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
|
64
|
-
|
|
65
|
-
|
|
|
62
|
+
[Cuprite Documentation](https://www.rubydoc.info/gems/cuprite/)
|
|
63
|
+
[Selenium Additional Preferences Documentation](https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Chromium/Options.html#add_preference-instance_method)
|
|
64
|
+
|
|
65
|
+
| Option | Driver | Usage | Description |
|
|
66
|
+
|------------------------|-------------------------------|-------------------------------------------------------------------------------------------------|--------------------------------------------|
|
|
67
|
+
| remote | Selenium, Cuprite, Apparition | `selenium_chrome(remote: 'http://localhost:4444/wd/hub')` | Allows you to talk to a remote browser |
|
|
68
|
+
| additional_arguments | Selenium | `selenium_chrome(additional_arguments: ['window-size=1400,1920'] ` | Pass additional arguments to the driver |
|
|
69
|
+
| additional_preferences | Selenium | `selenium_chrome(additional_preferences: [{'download.default_directory': '<download_path>'}] )` | Pass additional preferences to the driver |
|
|
70
|
+
| timeout | Cuprite, Apparition | `cuprite(timeout: 60 )` | Sets the default timeout for the driver |
|
|
71
|
+
| save_path | Cuprite, Apparition | `cuprite(save_path: 'File.expand_path('./somewhere')' )` | Tells the browser where to store downloads |
|
|
72
|
+
| browser_options | Cuprite, Apparition | `cuprite(browser_options: { option: value, option: value })` | Pass additional options to the browser |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### BiDi Support
|
|
77
|
+
|
|
78
|
+
BiDi (Bidirectional Protocol) is enabled by default on all Selenium drivers (Chrome, Firefox, Edge). This allows bidirectional communication between the driver and browser.
|
|
79
|
+
It is still in active development so breaking changes are expected. Check the documentation for the latest implementation guides:
|
|
80
|
+
|
|
81
|
+
* [Selenium docs](https://www.selenium.dev/documentation/webdriver/bidi/)
|
|
82
|
+
* [W3C specification](https://w3c.github.io/webdriver-bidi/)
|
|
83
|
+
|
|
66
84
|
|
|
67
85
|
## Development
|
|
68
86
|
|
|
@@ -3,7 +3,7 @@ module DVLA
|
|
|
3
3
|
module Drivers
|
|
4
4
|
DRIVER_REGEX = /^(?:(?<headless>headless)_)?(?<driver>(selenium_(?<browser>chrome|firefox|edge)|cuprite|apparition))$/
|
|
5
5
|
|
|
6
|
-
OTHER_ACCEPTED_PARAMS = %i[timeout].freeze
|
|
6
|
+
OTHER_ACCEPTED_PARAMS = %i[timeout browser_options save_path remote].freeze
|
|
7
7
|
OTHER_DRIVERS = %i[cuprite apparition].freeze
|
|
8
8
|
SELENIUM_ACCEPTED_PARAMS = %i[remote additional_arguments additional_preferences].freeze
|
|
9
9
|
SELENIUM_DRIVERS = %i[selenium_chrome selenium_firefox selenium_edge].freeze
|
|
@@ -30,7 +30,7 @@ module DVLA
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
::Capybara.register_driver method do |app|
|
|
33
|
-
options = Object.const_get("Selenium::WebDriver::#{browser.to_s.capitalize}::Options").new
|
|
33
|
+
options = Object.const_get("Selenium::WebDriver::#{browser.to_s.capitalize}::Options").new(web_socket_url: true)
|
|
34
34
|
options.add_argument('--disable-dev-shm-usage')
|
|
35
35
|
|
|
36
36
|
if headless
|
|
@@ -50,19 +50,30 @@ module DVLA
|
|
|
50
50
|
options.add_preference(key, value)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
driver_browser = kwargs[:remote] ? :remote : browser
|
|
54
|
+
driver_options = { browser: driver_browser, options: }
|
|
55
|
+
driver_options[:url] = kwargs[:remote] if kwargs[:remote]
|
|
56
|
+
|
|
57
|
+
::Capybara::Selenium::Driver.new(app, **driver_options)
|
|
54
58
|
end
|
|
55
59
|
else
|
|
56
60
|
kwargs.each do |key, _value|
|
|
57
61
|
LOG.warn { "Key: '#{key}' will be ignored | Use one from: '#{OTHER_ACCEPTED_PARAMS}'" } unless OTHER_ACCEPTED_PARAMS.include?(key)
|
|
58
62
|
end
|
|
59
63
|
|
|
64
|
+
browser_options = { 'no-sandbox': nil, 'disable-smooth-scrolling': true }
|
|
65
|
+
kwargs[:browser_options] && kwargs[:browser_options].each do |key, value|
|
|
66
|
+
browser_options[key] = value
|
|
67
|
+
end
|
|
68
|
+
|
|
60
69
|
::Capybara.register_driver method do |app|
|
|
61
70
|
Object.const_get("Capybara::#{driver.to_s.capitalize}::Driver").new(
|
|
62
71
|
app,
|
|
63
72
|
headless:,
|
|
64
|
-
timeout: kwargs[:timeout] ||
|
|
65
|
-
browser_options
|
|
73
|
+
timeout: kwargs[:timeout] || 60,
|
|
74
|
+
browser_options:,
|
|
75
|
+
save_path: kwargs[:save_path],
|
|
76
|
+
url: kwargs[:remote],
|
|
66
77
|
)
|
|
67
78
|
end
|
|
68
79
|
end
|
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.0
|
|
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-11 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.
|