java.net.ConnectException: Failed to connect to localhost error with Selenium 3.11.0 with IEDriverServer and IE 11 on Windows 10

后端 未结 4 751
难免孤独
难免孤独 2021-01-13 22:58

I am very new to selenium and trying to set up selenium in my laptop to begin. I am unable to invoke IE from my simple code. The details are given below. Can you please help

相关标签:
4条回答
  • 2021-01-13 23:20

    The issue in our case was not specific to Jenkins but the Chrome Driver crashing under the VMs where our automation tests run.

    If you log into your VM machine and where your workspace have been copied into, and under the terminal run the same maven command you have on Jenkins you should be able to watch the tests run and this may be a way for you to identify and fix the issue.

    0 讨论(0)
  • 2021-01-13 23:21

    The error says it all :

    3.9.0.0
    Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29313
    Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
    System info: host: 'DESKTOP-B1D1PSJ', ip: '192.168.79.96', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
    Driver info: driver.version: InternetExplorerDriver
    

    It is clear from your error stack trace that the new session is not getting initiated and the driver.version is also not getting recognized.

    Your main issue is the version compatibility between the binaries you are using as follows :

    • You are using Selenium Client v3.11.0
    • You are using IEDriverServer v3.9.0.0
    • You are using InternetExplorer v11.0 (as per your question)

    So there is a clear mismatch between the Selenium Client v3.11.0 , IEDriverServer v3.9.0.0.

    Solution

    • Upgrade IEDriverServer to v3.11.1.
    • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
    • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
    • If your base Web Browser base version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Browser.
    • Execute your @Test.

    Additional Considerations

    • You are using the flag INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true which is against the best practice. Don't do it.
    0 讨论(0)
  • 2021-01-13 23:39

    This answer is updated for Edge Browser. If you are using Edge Browser and facing the same issue. Then follow the steps:

    1. Download the latest IEDriverServer from this location : https://selenium.dev/downloads/

    2. Update your code as follows :

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.edge.EdgeDriver;
    
    public class SL001_OpenWebpage_Edge 
        {
            public static void main(String[] args) 
            {       
                System.setProperty("webdriver.ie.driver", "\\location\\IEDriverServer.exe");
    
                WebDriver driver=new EdgeDriver();
    
                driver.get("https://www.hul.co.in/");
    
                driver.findElement(By.id("tcm:1255-50553-4")).click();
    
                //driver.manage().window().maximize();
    
            }
        }
    
    0 讨论(0)
  • 2021-01-13 23:39

    I had this occur even with the same Driver and client versions.

    Started InternetExplorerDriver server (32-bit)
    3.141.59.0
    ...
    java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:XXXX
    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
    System info: host: 'HOST_NAME', ip: 'XX.XXX.XX.XX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_251'
    Driver info: driver.version: RemoteWebDriver
    

    I ended up finding a perfect match here

    http://selenium-release.storage.googleapis.com/index.html

    but the Security Settings in IE were different and not correct on a new computer. Making each zone have the same Enable Protected Mode box state (every one selected or deselected) in

    Internet Options -> Security
    

    Fixed it 100%. Was getting the driver to launch and navigate to a page, but the prior two steps fixed the errors.

    0 讨论(0)
提交回复
热议问题