Created
July 21, 2021 17:38
-
-
Save jwilsjustin/c81246d4f99e9d3fe406ded9e0d9a043 to your computer and use it in GitHub Desktop.
capybara chrome headless with media and logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.register_driver :selenium_chrome_headless_with_media do |app| | |
options = Selenium::WebDriver::Chrome::Options.new | |
options.add_argument("headless") | |
options.add_argument("use-fake-device-for-media-stream") | |
options.add_argument("use-fake-ui-for-media-stream") | |
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( | |
"goog:loggingPrefs" => { | |
browser: "ALL" | |
} | |
) | |
Capybara::Selenium::Driver.new( | |
app, | |
browser: :chrome, | |
desired_capabilities: capabilities, | |
options: options | |
) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pp Capybara.page.driver.browser.manage.logs.get(:browser).map(&:message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment