1

This is my TESTNG.xml

`<suite name="Test Suite">
<test name="test" parallel="classes" thread-count="2" preserve-order="true">
<classes>
<class name="Test1"/>
<class name="Test2"/>
<class name="Test3"/>
<class name="Test4"/>
<class name="Test5"/>
</classes>
</test>
</suite>`

Hub: java -jar selenium-server-standalone-2.43.1.jar -role hub -maxSession=2

Node: java -jar selenium-server-standalone-2.43.1.jar -Dwebdriver.chrome.driver=%chromeDriverPath% -role webdriver -hub http://%hubIPAndPort%/grid/register -maxSession 2 -browser "platform=%platform%,javascriptEnabled=true,browserName=%browserName%,takesScreenshot=true,version=%browserVersion%,maxInstances=%maxInstances%"

Problem:

When I run Two test classes with 2 maxSession count it works fine (Same with 5, 10, 15 ..)

But when I add a test more than the maxSession specified, say I added three more tests,now test spawns with two browsers, gets the LandingPage but would't proceed.

TestNG version: 6.8.8 Selenium version: 2.43.1

What am I doing wrong here ?

1
  • Please share the code where you are creating the driver. Commented Apr 7, 2015 at 7:36

1 Answer 1

0

Obviously I wasn't using ThreadLocal and my driver instance was also static. Started using ThreadLocal and got by problem fixed.

public void instantiateDriverObject(String browser) {
DriverFactory factory = new DriverFactory();
driver = factory.createInstance(browser);
driverThread = new ThreadLocal<WebDriver>() {
@Override
protected WebDriver initialValue() {
webDriverPool.add(driver);
return driver;
}
};
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.