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 +4 -4
- data/README.md +13 -6
- data/lib/dvla/browser/drivers/meta_drivers.rb +10 -3
- data/lib/dvla/browser/drivers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8da6eeae318b60a79423151f0cf96e4c45272a6f914bcca02ed181e6dda58534
|
4
|
+
data.tar.gz: 108bf3a7c120f485e45d792cee4340aa5b910fa2700ab8d350f9e63e2cef2ec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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 |
|
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] ||
|
65
|
-
browser_options
|
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
|
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.
|
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-
|
12
|
+
date: 2024-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: apparition
|