dvla-browser-drivers 3.0.0 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98bded336a42bbcf8b073809a113cd5095df3961d4faa3537f514c61db6d536c
4
- data.tar.gz: ee8bc6e39703ff92081610371753a6109985f20a6e51e51b47c8352fbc6b4043
3
+ metadata.gz: 8da6eeae318b60a79423151f0cf96e4c45272a6f914bcca02ed181e6dda58534
4
+ data.tar.gz: 108bf3a7c120f485e45d792cee4340aa5b910fa2700ab8d350f9e63e2cef2ec9
5
5
  SHA512:
6
- metadata.gz: 664cf5f58d396164af406b9fbe3692c44d84d8db130d1e81360543fe0c589c5f7d6a7baa85f02714af753ed2b8ec0583d48c8891953bdcf2a6390cb25c0a363a
7
- data.tar.gz: 693cd79891a22fb97a32dfd98881ba854cdf84b08525be93dea1a2967c879e5ebab828522fcfc1e8c81d65d4c32da129cad0bf6df5905f126232baefe5bf12c3
6
+ metadata.gz: 1e197efefd95376a89f478718ae7ecc7e0612c1e1c9954bcacfcfb9fd281f6c77c4152e6d5d498cb21e72ae7af0c22288fdd36f49eaf4486ba9e24d0b74187cf
7
+ data.tar.gz: 9ff7699e2e86e3a16466b02642ba7c23c47b038ac01acd48344a52956d4652b59bf673e5e41d3be51c7579953557d492c8dcab645025b124115b89d083201d0e
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,17 @@ 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 |
66
73
 
67
74
  ## Development
68
75
 
@@ -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
@@ -57,12 +57,19 @@ module DVLA
57
57
  LOG.warn { "Key: '#{key}' will be ignored | Use one from: '#{OTHER_ACCEPTED_PARAMS}'" } unless OTHER_ACCEPTED_PARAMS.include?(key)
58
58
  end
59
59
 
60
+ browser_options = { 'no-sandbox': nil, 'disable-smooth-scrolling': true }
61
+ kwargs[:browser_options] && kwargs[:browser_options].each do |key, value|
62
+ browser_options[key] = value
63
+ end
64
+
60
65
  ::Capybara.register_driver method do |app|
61
66
  Object.const_get("Capybara::#{driver.to_s.capitalize}::Driver").new(
62
67
  app,
63
68
  headless:,
64
- timeout: kwargs[:timeout] || 30,
65
- browser_options: { 'no-sandbox': nil, 'disable-smooth-scrolling': true },
69
+ timeout: kwargs[:timeout] || 60,
70
+ browser_options:,
71
+ save_path: kwargs[:save_path],
72
+ url: kwargs[:remote],
66
73
  )
67
74
  end
68
75
  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.0.1'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Driver and Vehicle Licensing Agency (DVLA)
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-11-13 00:00:00.000000000 Z
12
+ date: 2024-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: apparition