Getting Started with Headless Chrome

1 min


636
636 points
headless chrome
headless chrome

Getting Started with Headless Chrome

Headless chrome is delivered in Chrome 59. It allows you to run the Chrome browser in a headless environment.

A headless browser is a great tool for automated testing and server environments where you don’t need a visible UI shell.

A while ago I wrote an article how to run tests on chrome headless using docker  but now you can make the new changes in your project.

Start chrome headless
Capybara.register_driver :chrome_headless do |app|
  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    chromeOptions: {
      args: %w[ no-sandbox headless disable-gpu ]
    }
  )

  Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
end

Also you should set default_driver instead of current_driver.

Capybara.configure do |config|
  config.run_server = false
  config.default_driver = :selenium
  config.app_host = 'https://www.google.com' # change url
end

For more informations about chrome headless you should check this out.

Happy Testing!


Like it? Share with your friends!

636
636 points

What's Your Reaction?

cute cute
0
cute
scary scary
0
scary
wtf wtf
0
wtf
geek geek
0
geek
WIN WIN
0
WIN
Love Love
0
Love
OMG OMG
0
OMG
Angry Angry
0
Angry
Lol Lol
0
Lol
Test engineer

0 Comments

Your email address will not be published. Required fields are marked *

Choose A Format
Trivia quiz
Story