WebDriver - Errno::ECONNREFUSED: 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)

Fixed Issue #14835845

Details

Author
Mark D.
Created
Nov 27, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Issue
It seems like there is something wrong with the edge driver.
simple .quit commands don’t work anymore in watir/selenium where they do work perfectly i.c.w. Chrome/FF

My setup
Windows 10 (x64)
Microsoft Edge 40.15063.674.0
Microsoft EdgeHTML 15.15063
Edgedriver 15063
ruby 2.3.3 (x86)

gems list

*** LOCAL GEMS ***
appium_lib (9.6.0)
awesome_print (1.8.0)
backports (3.8.0)
bigdecimal (1.3.2, default: 1.2.8)
builder (3.2.3)
bundler (1.15.4)
childprocess (0.8.0, 0.7.1)
cucumber (2.4.0)
cucumber-core (2.0.0, 1.5.0)
cucumber-wire (0.0.1)
diff-lcs (1.3)
Eventer (1.0.0)
facets (3.1.0)
faraday (0.13.1, 0.13.0)
faraday_json (0.1.4)
faraday_middleware (0.12.2)
ffi (1.9.18 x86-mingw32)
gherkin (4.1.3)
io-console (0.4.6, default: 0.4.5)
json (2.1.0, default: 1.8.3)
lapis_lazuli (2.0.1, 2.0.0)
mini_portile2 (2.2.0)
minitest (5.10.3)
multi_json (1.12.2, 1.12.1)
multi_test (0.1.2)
multi_xml (0.6.0)
multipart-post (2.0.0)
nokogiri (1.8.0 x86-mingw32)
psych (2.2.4, default: 2.1.0)
rdoc (5.1.0, default: 4.2.1)
require_all (1.4.0)
rubyzip (1.2.1)
selenium-webdriver (3.7.0, 3.6.0)
tai64 (0.0.5)
teelogger (0.5.1)
thor (0.20.0, 0.19.4)
tomlrb (1.2.4)
watir (6.9.1)
websocket (1.2.4)

Watir + ruby bindings

irb(main):002:0> require 'watir'
=> true
irb(main):003:0> browser = Watir::Browser.new :edge
=> #<Watir::Browser:0x..fe93722ba url="about:blank" title="">
irb(main):004:0> browser.goto "http://google.com"
=> "http://google.com"
irb(main):005:0> browser.quit
Errno::ECONNREFUSED: 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)
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
        from C:/Ruby23/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from C:/Ruby23/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:878:in `connect'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1476:in `begin_transport'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1433:in `transport_request'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1407:in `request'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1156:in `get'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:128:in `block in stop_server'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:108:in `block in connect_to_server'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:853:in `start'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:584:in `start'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:104:in `connect_to_server'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:128:in `stop_server'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:77:in `stop'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/edge/driver.rb:72:in `quit'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.9.1/lib/watir/browser.rb:143:in `close'
        from (irb):5
        from C:/Ruby23/bin/irb.cmd:19:in `<main>'
irb(main):006:0>

Selenium + ruby bindings

irb(main):001:0> require 'selenium-webdriver'
=> true
irb(main):002:0> driver = Selenium::WebDriver.for :edge
=> #<Selenium::WebDriver::Edge::Driver:0x136c312 browser=:MicrosoftEdge>
irb(main):003:0> driver.navigate.to "http://google.com"
=> nil
irb(main):004:0> driver.title
=> "Google"
irb(main):005:0> driver.quit
Errno::ECONNREFUSED: 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)
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
        from C:/Ruby23/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from C:/Ruby23/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:878:in `connect'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1476:in `begin_transport'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1433:in `transport_request'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1407:in `request'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:1156:in `get'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:128:in `block in stop_server'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:108:in `block in connect_to_server'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:853:in `start'
        from C:/Ruby23/lib/ruby/2.3.0/net/http.rb:584:in `start'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:104:in `connect_to_server'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:128:in `stop_server'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/service.rb:77:in `stop'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/edge/driver.rb:72:in `quit'
        from (irb):5
        from C:/Ruby23/bin/irb.cmd:19:in `<main>'
irb(main):006:0>

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

  • Hi Mark,

    I have noticed some timing differences (delays) with the new bindings and/or webDriver.  Do your test cases have explicit waits in them around the failing areas?  If not can you retry your testing with explicit waits?  Adding them corrected some test cases that began to fail recently.

    Let me know,

    Steve

  • Hi Steven,

    I mentioned the click in the top section, but that is covered by another ticket (but I see no option to edit my response anymore), sorry about that.
    But when I do a browser.quit or driver.quit I always see this error.
    So no timing is involved here. It just always happens when I quit the browser.
    When I use irb it’s not a test script that runs, but just me typing in commands manually.
    I do see the browser being closed down, but after that this error appears.

    Cheers,
    Mark

  • Another thing I noticed is that when I run my test suite. I have configured it so that after each feature file it will close the browser instance and start up a new one. Each last test of that feature file fails with the same error as mentioned above. Like it closes the browser to soon or something.

  • Microsoft Edge Team

    Changed Steps to Reproduce

  • I updated the ticket by removing the “.click” mention.  Let me know if I my change is not correct.

    Can you provide a simplified repro?  E.g. your test suite with just two test cases with most of the test code removed but what is essential for testing the .quit between each test case?  I want to look at the timing and how the test is setup, etc.

  • Just to be clear, the .quit used to work with the previous version of Windows 10 and the MicrosoftWebDriver.exe?  Will you provide the extended version of Windows 10 you are seeing this on?  Win + S and type ‘winver’ and press enter.

    Also, I just realized that your test cases have already been provided.  The view I have in my tool removed the <cr><lf>’s and so I thought it was all output.

    As an FYI, there has been some discussion about the usability of localhost in general.  Not sure if there was a change to the security settings that could be causing this.  I will investigate this.  Here are references for what I am referring to.  Reminder, that this is a only a guess but something to think about related to localhost usage in general.  :-)

    https://tools.ietf.org/html/draft-ietf-dnsop-let-localhost-be-localhost-01
    https://w3c.github.io/webappsec-secure-contexts/#localhost

    Thanks again and I will let you know what we find,

    Steve

  • Hi Steven,

    Thanks for your update.

    Update:

    • The update is correct

    Windows 10:

    • Win10 & 15.15063 & .quit used to work for me
    • My current version is: 1703 (OS Build 15063.726)

    Example:

    • Indeed in the description I have some small samples. If you need anything else, let me know
  • Here is a gist with logger.level = :info (in case this is useful)
    https://gist.github.com/mark0203/b9d759e737cdaddb6c95954b491a6d7b

  • Microsoft Edge Team

    Changed Title from “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)” to “WebDriver - Errno::ECONNREFUSED: 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)”

  • Hi Mark,

    I tested this in 17134.112 (Ruby 2.5.1.1, Selenium 3.12.0) and was not able to repro this issue.  Here is my test results and test information.  Let me know if this is still an issue for you.

    Steve

    irb(main):040:0> require ‘selenium-webdriver’
    => true
    irb(main):041:0> driver = Selenium::WebDriver.for :edge
    => #<Selenium::WebDriver::Edge::Driver:0x704524b0 browser=:MicrosoftEdge>
    irb(main):042:0> driver.navigate.tohttp://google.com
    => nil
    irb(main):043:0> driver.title
    => “Google”
    irb(main):044:0> driver.quit
    => nil
    irb(main):045:0>

    PS C:\WINDOWS\system32> gem list

    *** LOCAL GEMS ***

    bigdecimal (default: 1.3.4)
    childprocess (0.9.0)
    cmath (default: 1.0.0)
    csv (default: 1.0.0)
    date (default: 1.0.0)
    dbm (default: 1.0.0)
    did_you_mean (1.2.0)
    etc (default: 1.0.0)
    fcntl (default: 1.0.0)
    ffi (1.9.25 x64-mingw32)
    fiddle (default: 1.0.0)
    fileutils (default: 1.0.2)
    gdbm (default: 2.0.0)
    io-console (default: 0.4.6)
    ipaddr (default: 1.2.0)
    json (default: 2.1.0)
    minitest (5.10.3)
    net-telnet (0.1.1)
    openssl (default: 2.1.0)
    power_assert (1.1.1)
    psych (default: 3.0.2)
    rake (12.3.0)
    rdoc (default: 6.0.1)
    rubyzip (1.2.1)
    scanf (default: 1.0.0)
    sdbm (default: 1.0.0)
    selenium-webdriver (3.12.0)
    stringio (default: 0.0.1)
    strscan (default: 1.0.0)
    test-unit (3.2.7)
    webrick (default: 1.4.2)
    xmlrpc (0.3.0)
    zlib (default: 1.0.0)

    PS C:\WINDOWS\system32> choco list -li | wsl grep -i ruby
    ruby 2.5.1.1

  • Hi Steven,

    Unfortunatelly this is still an issue for me.
    I tested with:

    • Microsoft Edge 42.17134.1.0
    • Microsoft EdgeHTML 17.17134
    • Winver 1803 (build 17134.112)
    • ruby 2.4.4p296 (2018-03-28 revision 63013) [x64-mingw32]

    *** LOCAL GEMS ***

    backports (3.11.3)
    bigdecimal (default: 1.3.2)
    builder (3.2.3)
    childprocess (0.9.0)
    cucumber (3.1.0)
    cucumber-core (3.1.0)
    cucumber-expressions (5.0.17)
    cucumber-tag_expressions (1.1.1)
    cucumber-wire (0.0.1)
    deep_merge (1.2.1)
    did_you_mean (1.1.0)
    diff-lcs (1.3)
    Eventer (1.0.0)
    facets (3.1.0)
    faraday (0.15.1)
    faraday_json (0.1.4)
    faraday_middleware (0.12.2)
    ffi (1.9.23 x64-mingw32)
    gherkin (5.0.0)
    io-console (default: 0.4.6)
    json (default: 2.0.4)
    lapis_lazuli (2.1.3)
    minitest (5.10.1)
    multi_json (1.13.1)
    multi_test (0.1.2)
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    net-telnet (0.1.1)
    openssl (default: 2.0.7)
    power_assert (0.4.1)
    psych (default: 2.2.2)
    rake (12.0.0)
    rdoc (default: 5.0.0)
    require_all (1.5.0)
    rubyzip (1.2.1)
    selenium-webdriver (3.12.0)
    tai64 (0.0.5)
    teelogger (0.5.1)
    test-unit (3.2.3)
    thor (0.20.0)
    watir (6.10.3)
    xmlrpc (0.2.1)

    Here is the gist:
    https://gist.github.com/mark0203/0ff120f1b106c88dfaea748031765496

  • Hi Mark,

    I am wondering if this is related to localhost security changes in Windows.

    Basic
    loopback access has been disabled for security purposes for Windows Store apps and
    any application running in the new App Container model, which Edge does. 
    On my system, I disabled this for various
    testing and then forgot about it. 

    Apologize for forgetting about that. :-/

     

    Will you
    try exempting Edge and the IRB binary using Fiddler4’s builtin WinConfig tool? 
    See the attached screenshots and the link
    below.

    https://blogs.msdn.microsoft.com/fiddler/2011/12/10/revisiting-fiddler-and-win8-immersive-applications/

    Steve

  • Hi Steven,

    I still don’t know what the solution is to the problem.
    Can you break it down so it’s easier to understand for someone like me?
    What I did try (but did not resolve into this issue to disappear):

    So I don’t know how to fix this.
    Please help.

    Mark

  • I got Fiddler to install: http://fiddler2.com/r/?GetFiddler4Beta
    And I selected the two options you showed in the picture, but it still gives me this error.
    Also I checked about:flags and checked and unchecked all loopback boxes (same result).
    So I really need more details how to set things correctly if this is the issue.
    Another side note: IRB I don’t see in any of these tools (also not when running) and it works with Chrome and Firefox, so I’m not sure if this is nessasary at all.

  • Ok now I’m officially confused…
    I rebooted the machine, after resetting all the settings back to normal (so far still getting the same error).
    Then I got a suggestion on the slack chat selenium channel that it might be firewall related. So I disabled the Windows firewall, checked again, and it worked.
    Then I turned the firewall back on and everything is still working.
    I’ll do a bit more tests but might be difficult to replicate now since it’s working fine.

  • Hi Steve,
    If it was really resolved by turning the firewall off and back on again, I don’t know, but I cannot reproduce the issue anymore now. So I would mark it as fixed.
    Mark

  • Microsoft Edge Team

    Changed Status to “Fixed”

  • Hi Mark,

    Appreciate the responses.  I am glad you were to resolved the issue as I was not able to reproduce it.  Apparently it was something in the firewall settings or config that needed to be “cleaned” up?  I don’t like not knowing but I think we will have to just keep an eye on this.  Your feedback is useful if anyone gets this issue again.

    Also, as an FYI, Edge has different access to the networking components so Edge might not work and other browsers continue to work and vice-versa.

    I will mark this an fixed.  :-)

    Thanks again,

    Steve

You need to sign in to your Microsoft account to add a comment.

Sign in