简体   繁体   中英

How do I set options for the Selenium MS Edge driver in ruby?

I am trying to open a browser with the Selenium::WebDriver::Edge::Driver on Windows. I am able to open the browser but my session immediately crashes with this error:

unknown command: Cannot call non W3C standard command while in W3C mode 
(Selenium::WebDriver::Error::UnknownCommandError)

How would I turn off W3C mode in selenium ruby? I have tried to follow the docs here by doing:

webdriver_options = Selenium::WebDriver::Edge::Options.new(opts: {w3c: false})

before instantiating the webdriver. However this does not seem to make a difference - I suspect I am setting the options wrong. Has anyone seen this issue before? Thanks.

  1. verify if your browser is up to date
  2. Start > Settings > System > About; - and verify OS build
  3. Download last driver: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
  4. Unzip las version on: C:\\Ruby23-x64\\bin;
  5. If you are using capybara, try this:

    Capybara.register_driver :selenium do |app|

    Capybara::Selenium::Driver.new(app, :browser => :edge)

    end

If you're using Edge Chromium, I think the options are like the Chrome's. You could refer to this thread and add the following code then pass it into the driver:

capabilities = { "edgeOptions" => {'w3c' => false} }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM