0

I'm setting up tests using rspec and capybara within wsl2. I have had to use a remote selenium server because wsl2 can't open browser windows. I would like to set the headless option on my configuration but I am unable to find documentation that would help me.

My code is as follows within rails_helper.rb: `

Rspec.configure do |config|
  config.before(:each, type: :system) do
    driven_by :selenium, using: :remote,
                          options: {
                            browser: :chrome,
                            url: 'http://192.168.56.1:4444'}
  end
end

`

I want to put something into options like args: 'headless', but that just gives me an unknown keyword error. I've tried looking up documentation in the webdrivers gem, chromedriver, rspec, selenium, and capybara. They either don't have anything or they will have a different format that won't work when I try to include it.

I can't think of any more places to look so I'm asking a question.

Rajagopalan
  • 5,465
  • 2
  • 11
  • 29
  • Capybara tag is more important than other tags. Include that while you raise capybara related questions. – Rajagopalan Nov 14 '22 at 05:45
  • Try this `options.add_argument('--headless') ` and pass option in registering driver – Kiran Reddy Nov 24 '22 at 10:10
  • @KiranReddy, I tried adding your suggestion as a separate entry at the end and inserting the .add_argument('--headless') between the options and the semicolon. then I tried setting up option as a variable with the content of the browser and url and passing your code on the next line. But it comes up as an undefined method so I'm having trouble on how to add the code you suggested. Can you elaborate? – user12685852 Nov 27 '22 at 02:09

0 Answers0