0
votes

I am running parallel test (one test per thread) with Selenium + Chromeriver. Each thread creates a new chrome driver instance (driver = new ChromeDriver(options);) and close it when the test ends using driver.quit(). Once in a while I see the following exception getting thrown. This exception is thrown after chrome driver starts up and half way through the test. Can one thread calling driver.quit() close the instance of other? What could be causing this? Has any one dealt with this before?

ChromeDriver version is v85.0.4183.87.

 org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:12406\nBuild info: version: 'unknown', revision: 'unknown', time: 'unknown'\nSystem info: host: '6d3453df-688f-4be0-a709-7b7b08b464a0', ip: '172.17.128.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1074-aws', java.version: '11.0.8'\nDriver info: driver.version: RemoteWebDriver\n\tat org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
1
can you share your xml here ?Justin Lambert
are you running parelly for tests,classes,instances?Justin Lambert
@JustinLambert what xml are you referring to? Each test class instance run on its own different thread and it would independently create an instance of the chrome driver and run a bunch of commands on the driver to navigate to a page, login etc.IS_EV
Pls check below answer, if you running tests in XML you will not occur any issuesJustin Lambert
@JustinLambert Thanks for the suggestion. My requirement is different, I am not using any testing frame work. My requirement is to validate certain flows , capture network traffic etcIS_EV

1 Answers

0
votes
If you create xml file in project level and run 

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="tests" thread-count="2">
    <test name="Test">
        <classes>
            <class name="Parallel"/>
        </classes>
    </test> <!-- Test -->
</suite>