Reputation: 41
When I set the option "--remote-debugging-port", it will throw an error. And without this option, it can work properly. However, I want to debug when using the headless chrome. How can I do ?
.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/protocol.rb:158:in `rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
Here is my code:
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--remote-debugging-port') # debug
@driver = Selenium::WebDriver.for(:chrome, options: options)
puts @driver.manage.logs.get :browser
Upvotes: 4
Views: 7368
Reputation: 193338
As per Getting Started with Headless Chrome to enable remote-debugging you can add the argument remote-debugging-port
through Selenium::WebDriver::Chrome::Options.new
which will help in:
Navigating to http://localhost:9222 in another browser to open the DevTools interface or use a tool such as Selenium to drive the headless browser.
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--remote-debugging-port=9222')
@driver = Selenium::WebDriver.for(:chrome, options: options)
puts @driver.manage.logs.get :browser
Upvotes: 2