-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
headless_chrome issue #211
Comments
The issue is that So, to run Chrome headless and have it work with screenshots you'll need something like this in your capybara config, Solution: # NOTE: must be called `:selenium` not `:chrome_headless`
Capybara.register_driver :selenium do |app|
options = Selenium::WebDriver::Chrome::Options.new(
# It's the `headless` arg that make Chrome headless
# + you also need the `disable-gpu` arg due to a bug
args: %w[headless disable-gpu window-size=1366,768],
)
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: options
)
end Alternative solution (this is unnecessary if you do the above) you can register a new screenshot driver for whatever you called your driver. Could be Capybara::Screenshot.register_driver(:headless_chrome) do |driver, path|
driver.browser.save_screenshot(path)
end I think this can be closed as not a bug as registering drivers is documented. But it's useful to have for people like me Googling who also thought it was a bug at first, not realising that what you call your driver matters for some reason. It might be worth opening a new issue for drivers being determined from their name, rather than inferrer as what they actually are. I don't know the reasoning behind the way it is. |
Since Capybara has added support for Headless Chrome and calls it
|
I have this error:
|
@romenigld that's very odd, it looks like the gem |
In env.rb =>Metodo que chama o chrome em modulo headlessCapybara.register_driver :selenium do |app| in helper.rb =>Metodo para tirar screenshot e embeda no relatorio htmlmodule Helper in hooks.rb =>Depois de cada scenario ele tira uma screnshot e remove todos os espaços e virgulasAfter do |scenario| Se meu senario falhar tira um print e salva no caminho que defino em helper.rbif scenario.failed? Se meu senario passar tira um print e salva no caminho que defino em helper.rbtake_screenshot(scenario_name.downcase!, 'passed') |
What? |
Link: https://github.com/Vilariano/TesteGoogle.git If you already have cucumber installed and configured, just download the file to run on your machine. Any questions send me an email! abs, |
The text was updated successfully, but these errors were encountered: