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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98bded336a42bbcf8b073809a113cd5095df3961d4faa3537f514c61db6d536c
4
- data.tar.gz: ee8bc6e39703ff92081610371753a6109985f20a6e51e51b47c8352fbc6b4043
3
+ metadata.gz: ac07160d1bc1d37efd9b23fca6eb49e7b591c63394322b7c2bd1c65328568523
4
+ data.tar.gz: baaf5af95ef7185e130b5f6ae6ef1d4b00620b18d0a2490607aaa5e8a460a566
5
5
  SHA512:
6
- metadata.gz: 664cf5f58d396164af406b9fbe3692c44d84d8db130d1e81360543fe0c589c5f7d6a7baa85f02714af753ed2b8ec0583d48c8891953bdcf2a6390cb25c0a363a
7
- data.tar.gz: 693cd79891a22fb97a32dfd98881ba854cdf84b08525be93dea1a2967c879e5ebab828522fcfc1e8c81d65d4c32da129cad0bf6df5905f126232baefe5bf12c3
6
+ metadata.gz: 109149e21784a203260a5c0bed209b53cfe998f4fb71ae5199a8aa605e2e4455b5d09ac574e8f8ffb33974dd76f9fa99c73768a2db6e3a5fed319c9854f43e4c
7
+ data.tar.gz: 7a795f13005830a63ecbd8c780a474798626eaf3dbaee5b5ca33a3bb572000fd18c8f517e727abd538cab21cc5cd861cf2c3c49b3dde5ac0ab7337af2b7548b8
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+
5
+ # [3.1.0] - 2025-12-10
6
+
7
+ - Add websocket URL to enable BiDi functionality via Selenium
8
+ - 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.0'
12
- gem 'rspec', '~> 3.11'
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
- | Option | Description | supported-browsers |
61
- |-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|
62
- | remote: 'http://localhost:4444/wd/hub' | Allows you to talk to a remote browser | firefox |
63
- | additional_arguments: ['window-size=1400,1920'] | Pass additional arguments to the driver<br/>Supported switches: https://peter.sh/experiments/chromium-command-line-switches/ | chrome, edge, firefox |
64
- | additional_preferences: [{'download.default_directory': '<download_path>'}] | Pass additional preferences to the driver<br/>Documentation: https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Chromium/Options.html#add_preference-instance_method | chrome, edge, firefox |
65
- | additional_arguments: { 'option': value, 'option': value } | Pass additional arguments to the driver<br/>Supported switched: https://www.rubydoc.info/gems/cuprite/ | cuprite, apparition |
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
- ::Capybara::Selenium::Driver.new(app, url: kwargs[:remote], browser:, options:)
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] || 30,
65
- browser_options: { 'no-sandbox': nil, 'disable-smooth-scrolling': true },
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
@@ -3,7 +3,7 @@
3
3
  module DVLA
4
4
  module Browser
5
5
  module Drivers
6
- VERSION = '3.0.0'
6
+ VERSION = '3.1.0'
7
7
  end
8
8
  end
9
9
  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.0.0
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: 2024-11-13 00:00:00.000000000 Z
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.