Edge browser crashing after initial watir-webdrive

2019-05-29 11:03发布

问题:

I'm using the latest selenium-webdriver (2.47.1) and watir-webdriver (0.8.0) and have the Edge WebDriver installed in the Ruby/bin folder like other webdriver.exe files; like chromedriver or iedriver. It appears to launch the Edge browser but does not attempt to goto the URL before closing the browser out and failing all of my tests. I have it allowed by the Firewall within Windows, when i run my rspec tests it states:

Selenium::WebDriver::Error::NoSuchWindowError: no such window

Has anybody gotten MSWebdriver to work with watir-webdriver?

Error:

c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/response.rb:71:in `assert_ok': not implemented (Selenium::WebDriver::Error::WebDriverError)
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/bridge.rb:657:in `raw_execute'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/bridge.rb:635:in `execute'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/remote/bridge.rb:221:in `switchToDefaultContent'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/common/target_locator.rb:96:in `default_content'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/watir-webdriver-0.8.0/lib/watir-webdriver/browser.rb:385:in `assert_exists'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/watir-webdriver-0.8.0/lib/watir-webdriver/browser.rb:110:in `url'
        from c:/Ruby-222-x64/lib/ruby/gems/2.2.0/gems/watir-webdriver-0.8.0/lib/watir-webdriver/browser.rb:79:in `goto'
        from msedge.rb:4:in `<main>'

Additionally, IE works as expected.

回答1:

Look like this question has become very old but let me try answering if someone is still looking for answers....

Following points to consider when using MSWebdriver for MSEdge

1) Download the driver for your OS build only, other MSWebDriver wont work How to check your Windows 10 OS build?? Open Run(Win+R) and type winver

2) After you download correct version then place it in any folder which is present in PATH variable or place it somewhere and add that location to PATH variable

3) Now run your tests normally with initializing edge browser appropriately eg: ruby-webdriver : driver = Selenium::WebDriver.for :edge

Hope this helps!! Happy Automation!!



回答2:

FYI - I've been able to work with the Edge browser on Windows 10 with this configuration:

  • Ruby 2.1.6
  • watir-webdriver (0.9.1)
  • selenium-webdriver (2.49.0)

Then:

  1. Download the Microsoft Web Driver server's installer from https://www.microsoft.com/en-us/download/details.aspx?id=48212
  2. Run the installer, which will place the Web Driver server's executable in: C:\Program Files (x86)\MicrosoftWebDriver\MicrosoftWebDriver.exe
  3. Copy the executable to a folder in your search path (i.e. C:\Ruby21\bin\ )

Note that the server starts when you launch a new Edge browser object, but may hang if the browser terminates unexpectedly. In which case the server needs to be manually terminated using Windows Task Manager before another instance of the Edge browser is able to communicate with the server.