When does Selenium hub run one node at a time? I might be wrong around both selenium code and testNG xml.
I've configured TestNG.xml to run parallel threads and grid framework seems alright, hub active on 5555, http://xx.xx.xx.xx:5555/grid/console shows two nodes connected and active with IE browser. IE driver server is used to launch IE on both these nodes, selenium-server-standalone-2.35.0 is used for the grid on all nodes and hub. When I 'run as TestNG Test' on eclipse or through Jenkins via pom.xml, the script launches on node1 first and in the next run launches on node 2.
Could it be: 1. Wrong testNG.xml/selenium grid code? 2. Hub starts up with maxinstances=1, is this causing it? What's the solution to it? Tried using hubconfig.json but doesn't seem to take affect. 3. Any misconfiguration at nodes? 4. IEDriverServer or selenium server version issues? [tried 37/39 versions as well]..
TestNG.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="CO" verbose='1' parallel="tests" thread-count="10" preserve-order="true">
<test name="FI" preserve-order="true">
<parameter name="browser" value="internet explorer" />
<parameter name="port" value="5566" />
<classes>
<class name="src/test/java.clickonce.remoteFresh"/>
</classes>
</test> <!-- Test -->
<test name="Ad" preserve-order="true">
<parameter name="browser" value="internet explorer" />
<parameter name="port" value="5567" />
<classes>
<class name="src/test/java.clickonce.Admin"/>
</classes>
</test>
</suite>
<!-- Suite -->
Selenium code for grid:
@BeforeTest
public void setUp() throws IOException {
baseUrl = "http://xxx/";
nodeUrl = "http://xx.xx.xx.xx/wd/hub";
String sUrl = "http://xxx";
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
capability.setBrowserName("iexplorer");
capability.setPlatform(Platform.WINDOWS);
capability.setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true );
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
File file = new File("d:/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver WebDriverObj = new InternetExplorerDriver();
WebDriverObj.get(sUrl);
driver = new RemoteWebDriver(new URL(nodeUrl), capability);
selenium = new WebDriverBackedSelenium(driver, baseUrl);
}
Node commands -
java -jar selenium-server-standalone-2.35.0.jar - Dwebdriver.ie.driver="D:\IEDriverServer.exe" -role webdriver -hub http://
xx.xx.xx.xx:5555/grid/register -port 5566 -browser "browserName=iexplorer,platform=WINDOWS"
node 2 on 5567 port