I have a really simple script as a smoke test.
The script does the following:
- registers driver
- driver navigates to 'https://www.google.co.uk/'
- driver quits
Script:
require 'selenium-webdriver'
driver = Selenium::WebDriver.for(:edge)
driver.navigate.to("https://www.google.co.uk/")
driver.quit
When I run this, the driver opens Edge, navigates to google and MicrosoftWebDriver stops before the 'quit' method resulting in ruby raising an error.
Bellow is the output from the console:
PS C:\projects\sandbox> ruby test.rb
2017-09-22 11:54:32 DEBUG Selenium Executing Process ["C:/WebDrivers/MicrosoftWebDriver.exe", "--port=17556"]
Listening on http://localhost:17556/
2017-09-22 11:54:32 INFO Selenium -> POST session
2017-09-22 11:54:32 INFO Selenium >>> http://localhost:17556/session | {"desiredCapabilities":{"browserName":"MicrosoftEdge","platform":"WINDOWS"},"capabilities":{"firstMatch":[{"browserName":"MicrosoftEdge"}]}}
2017-09-22 11:54:32 DEBUG Selenium > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=utf-8", "Content-Length"=>"140"}
2017-09-22 11:54:33 INFO Selenium <- {"sessionId":"EAB1B8C2-DF58-4DED-BD52-8386F1FC9B0A","status":0,"value":{"browserName":"MicrosoftEdge","browserVersion":"25.10586.672.0","platformName":"windows","platformVersion":
"10","takesElementScreenshot":true,"takesScreenshot":true,"acceptSslCerts":true,"pageLoadStrategy":"normal"}}
2017-09-22 11:54:33 INFO Selenium Detected OSS dialect.
2017-09-22 11:54:33 INFO Selenium Forcing W3C dialect.
2017-09-22 11:54:33 INFO Selenium -> POST session/EAB1B8C2-DF58-4DED-BD52-8386F1FC9B0A/url
2017-09-22 11:54:33 INFO Selenium >>> http://localhost:17556/session/EAB1B8C2-DF58-4DED-BD52-8386F1FC9B0A/url | {"url":"https://www.google.co.uk/"}
2017-09-22 11:54:33 DEBUG Selenium > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=utf-8", "Content-Length"=>"35"}
2017-09-22 11:54:33 INFO Selenium <- {"sessionId":"EAB1B8C2-DF58-4DED-BD52-8386F1FC9B0A","status":0,"value":null}
2017-09-22 11:54:34 INFO Selenium -> DELETE session/EAB1B8C2-DF58-4DED-BD52-8386F1FC9B0A
2017-09-22 11:54:35 INFO Selenium <- {"sessionId":"EAB1B8C2-DF58-4DED-BD52-8386F1FC9B0A","status":0,"value":null}
Stopping server.
C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect': Failed to open TCP connection to localhost:17556 (No connection could be made because the target machine actively refused it. - connect(2)
for "localhost" port 17556) (Errno::ECONNREFUSED)
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
from C:/Ruby23-x64/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
from C:/Ruby23-x64/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:878:in `connect'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:1476:in `begin_transport'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:1433:in `transport_request'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:1407:in `request'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:1156:in `get'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:130:in `block in stop_server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:110:in `block in connect_to_server'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:853:in `start'
from C:/Ruby23-x64/lib/ruby/2.3.0/net/http.rb:584:in `start'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:106:in `connect_to_server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:130:in `stop_server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/service.rb:79:in `stop'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/edge/driver.rb:74:in `quit'
from test.rb:29:in `<main>'
What I have already tried to resolve this issue:
- I have disabled the Firewall and turned off the antivirus
- Tried different versions of MicrosoftWebDriver
- Tried different versions of SeleniumDriver
To me this looks like a MS specific issue since it did work before (I'm having the same issue now), but after a Windows update suddenly this message appeared. According to MS a possible solution would be to exempting Edge using Fiddler4’s (http://fiddler2.com/r/?GetFiddler4Beta) builtin WinConfig tool or with the CheckNetIsolation tool
To enable loopback for Edge, use this command:
CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
To disable loopback for Edge use this command:
CheckNetIsolation.exe LoopbackExempt –d –n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
For some reason om my local machine this did not resolve the issue yet. Then after some debugging with help, they gave me the hint that it might be firewall related. So I turned off the Windows firewall and tried again. Problem resolved. I turned the Windows firewall back on, and strangely the issue did not return.