Comments (14)
OK, I got it working. Oddly, I had to change chromeOptions:
in the Thoughtbot example code to 'chromeOptions' =>
to get it to work.
I still think it's worth mentioning how to get this working in the docs.
from chromedriver-helper.
I love Ruby more than most (it is by far my favorite programming language), but I gotta say the "symbol vs. string" hash key issue is one of the biggest warts on the language. 😭
from chromedriver-helper.
I was not able to get this to work with chromedriver version 2.28. When I updated to 2.31, it worked. Note that the path for the chromedriver bin is set by chromedriver-helper
and is in your gem path. I'd forgotten about this at first and so was inadvertently checking the version of chromedriver I had installed elsewhere.
Here is the code that I'm using in my cucumber features/support/env.rb
file that is working:
# Headless chrome browser.
# Use @selenium
Capybara.register_driver :selenium do |app|
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless', 'disable-gpu'])
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: options
)
end
chromedriver-helper v. 1.1.0
selenium-webdriver 3.4.4
from chromedriver-helper.
I found this article from Thoughtbot and tried following the instructions there. I verified that I'm using chromedriver 2.30 and Chrome 59, but the browser window appears, and when I go to chrome://version/, I don't see --headless
in the list.
Also worth mentioning is the Getting Started with Headless Chrome article from Google and the ChromeDriver Capabilities docs.
from chromedriver-helper.
If you're running on OSX - make sure to avoid the remote-debugging-port=9222
option, which causes chrome to hang, resulting in a Net::ReadTimeout
. (chrome 59.0.30, chromedriver 2.3)
from chromedriver-helper.
Can you share your driver config, please?
I followed https://robots.thoughtbot.com/headless-feature-specs-with-chrome instructions along with converting chromeOptions key to string as you suggested and nothing happened. Capybara stucks without any log information.
PS My version is:
Chromium 59.0.3071.109 Built on Ubuntu , running on Ubuntu 16.04
from chromedriver-helper.
Hey guys. I'm in the same boat as the others here. I've got Chromedriver working with Capybara, but I cannot, for the life of me, get the options working. Anytime I try to introduce the desired_capabilities
key, everything falls apart. I've tried changing symbols to keys, different options, chanting, yelling... nothing has worked yet.
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w(headless disable-gpu)
}
)
)
end
I've got Chromedriver 2.3 and selenium-webdriver
in the gemfile.
from chromedriver-helper.
@weedySeaDragon Your config works for me! I've got headless chrome running. Now I have all kinds of problems related to changing from Poltergeist to Chrome, but progress is being made.
🍺 🌮 🎉 Thanks very much.
from chromedriver-helper.
It appears that when running headless, JavaScript is disabled. Has anyone else had this problem?
from chromedriver-helper.
Thanks for opening this issue, and apologies for not responding earlier.
Honestly, I'm not sure it's within the ability of chromedriver-helper to opt into headless mode. All this gem does is download the correct executable for your platform and run it -- configuration needs to be done within your testing framework (e.g., Capybara).
I'm going to close this; though if I'm wrong and there's a PR that can be submitted to do this, I'm open to it.
from chromedriver-helper.
@flavorjones No problem at all, this is absolutely unrelated to your work. I'm going to go bark up the right tree now. Thanks very much for the gem!
from chromedriver-helper.
Thanks @weedySeaDragon, your config works. Did try ~ a dozen different config variants, to no avail.
@flavorjones Maybe how to pass options to the Driver (for example to run it headless) could be added to the Readme. I could open a PR, if desired.
from chromedriver-helper.
I had to downgrade selenium-webdriver to v 3.4.4. My system test config looks like this. Note how I am forcing a version downloaded by the helper too. I found there is no class level property to set for future binstub run
to take advantage of. This seemed like a good way to be consistent.
require 'test_helper'
driver = Chromedriver::Helper.new
driver.update('2.30')
Selenium::WebDriver::Chrome.driver_path = driver.binary_path
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
Capybara.register_driver :headless_chrome do |app|
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
'chromeOptions' => {
'args' => ['headless', 'disable-gpu', 'no-sandbox', 'window-size=1280,1024'],
'binary' => ENV['GOOGLE_CHROME_SHIM']
}.reject { |_k, v| v.nil? }
)
)
end
driven_by :headless_chrome
end
from chromedriver-helper.
Ah, I am using latest selenium-webdriver
gem now and driver.update('2.36')
version now.
from chromedriver-helper.
Related Issues (20)
- unknown error: call function result missing 'value' for Selenium Send Keys even after chromedriver upgrade HOT 1
- Chromedriver picks up wrong version HOT 13
- chromedriver-helper breaks projects not using it HOT 20
- No options to set log log-level and log-path HOT 6
- Using with Rails: "uninitialized constant Selenium" HOT 5
- Use LATEST_RELEASE file rather than guessing HOT 8
- Chromedriver helper downloading weird chromedriver version number HOT 2
- NameError: uninitialized constant Chromedriver in rails & rspec config HOT 5
- Mention "require" in README? HOT 3
- certificate verify failed (self signed certificate in certificate chain) (OpenSSL::SSL::SSLError) HOT 9
- Not executable: chromedriver-helper HOT 1
- No output with 'which chromedriver' after installing 2.1.0 HOT 3
- Not working in rspec (calling in rails_helper.rb) HOT 1
- Can't get this working in trivial case HOT 7
- Allow setting an environment variable to skip installation, for systems on which a compatible chromedriver is already installed HOT 11
- Use a compatible version of chromedriver HOT 8
- Version selection with LATEST_RELEASE is deprecated HOT 17
- Seeking new maintainer HOT 16
- Doc question HOT 1
- NOTICE: Ending support for this gem HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chromedriver-helper.