Why does the hub keep launching a blank browser before it runs a test on the node?
Every time a test starts to run, a blank browser is launched on the hub before it opens the same type of browser on the node. After the test finishes this blank browser won't close either on the hub. How can I get it to stop opening the blank browser on each test or close the blank browser after each test on the hub? I have a driver.quit in each of my script at the end but it doesn't seem to have any affect on the browser in the hub. It only closes the browser on the node. Please advise how I can fix this. Thanks for your help.
I attached my config and code below.
java -jar selenium-server-standalone-2.53.0.jar -role hub -hubConfig
Hub.json
java -jar selenium-server-standalone-2.53.0.jar -role node -nodeConfig
WindowsNode.json
java -jar selenium-server-standalone-2.53.0.jar -role node -nodeConfig
MacNode.json
Hub.JSON
{
"host": null,
"port": 4444,
"newSessionWaitTimeout": -1,
"servlets" : [],
"prioritizer": null,
"capabilityMatcher":
"org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 300000,
"browserTimeout": 0,
"maxSession": 1
}
WindowsNode.JSON
{
"capabilities":
[
{
"browserName": "firefox",
"platform": "WINDOWS",
"maxInstances": 1
},
{
"browserName": "chrome",
"platform": "WINDOWS",
"maxInstances": 1,
"webdriver.chrome.driver": "C:/Program Files (x86)/Google/Chrome
/Application/chrome.exe"
},
{
"browserName": "internet explorer",
"platform": "WINDOWS",
"maxInstances": 1,
"webdriver.ie.driver": "C:/Program Files (x86)/Internet
Explorer/iexplore.exe"
}
],
"configuration":
{
"maxSession":1,
"port":5554,
"hubPort":4444,
"hubHost": xxx.xxx.x.xx,
"nodePolling":2000,
"registerCycle":10000,
"cleanUpCycle":2000,
"timeout":30000,
"Dwebdriver.chrome.driver=C:\\SeleniumStandaloneServer
\\chromedriver.exe": "",
"Dwebdriver.ie.driver=C:\\SeleniumStandaloneServer
\\IEDriverServer.exe": ""
}
}
MACNode.JSON
{
"capabilities":
[
{
"browserName": "firefox",
"platform": "MAC",
"maxInstances": 1
},
{
"browserName": "chrome",
"platform": "MAC",
"maxInstances": 1
},
{
"browserName": "safari",
"platform": "MAC",
"maxInstances": 1
}
],
"configuration":
{
"maxSession": 1,
"port": 5555,
"host": localhost,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": xxx.xxx.x.xx
}
}
<suite name="Suite" preserve-order="true" verbose="4" thread-count="2">
<test name="Tests1">
<parameter name="browser" value="internet explorer"/>
<classes>
<class name="Tests.A_Test"/>
</classes>
</test>
<test name="Tests2">
<parameter name="browser" value="chrome"/>
<classes>
<class name="Tests.A_Test"/>
</classes>
</test>
<test name="Tests3">
<parameter name="browser" value="firefox"/>
<classes>
<class name="Tests.A_Test"/>
</classes>
</test>
<test name="Tests4">
<parameter name="browser" value="safari"/>
<classes>
<class name="Tests.A_Test"/>
</classes>
</test>
</suite>
public class TestBase {
public static WebDriver driver=null;
public String URL, Node;
@BeforeTest
@Parameters("browser")
public void Setup (String browser) throws IOException,
MalformedURLException{
{
DesiredCapabilities capabilities = null;
URL = "http://www.google.com";
if(browser.equals("firefox"))
{
driver=new FirefoxDriver();
capabilities = DesiredCapabilities.firefox();
capabilities.setBrowserName("firefox");
capabilities.setPlatform(Platform.ANY);
Node = "http://xxx.xxx.x.xx:5554/wd/hub";
}
else if (browser.equals("chrome"))
{
//Start chromedriver in windows hub and on mac node
System.setProperty("webdriver.chrome.driver",
"C:\\SeleniumStandaloneServer\\chromedriver.exe");
driver=new ChromeDriver();
capabilities = DesiredCapabilities.chrome();
capabilities.setBrowserName("chrome");
capabilities.setPlatform(Platform.ANY);
Node = "http://xxx.xxx.x.xx:5554/wd/hub";
}
else if (browser.equals("safari"))
{
driver = new SafariDriver();
capabilities = DesiredCapabilities.safari();
capabilities.setBrowserName("safari");
capabilities.setPlatform(Platform.MAC);
Node = "http://xxx.xxx.x.xx:5555/wd/hub";
}
else
{
System.setProperty("webdriver.ie.driver",
"C:\\SeleniumStandaloneServer\\IEDriverServer.exe");
driver=new InternetExplorerDriver();
capabilities = DesiredCapabilities.internetExplorer();
capabilities.setBrowserName("internet explorer");
capabilities.setPlatform(Platform.WINDOWS);
//Enable IE security tab protected mode for all zones
then you can skip flakiness line
//capabilities.setCapability(InternetExplorerDriver.
INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
capabilities.setCapability("ensureCleanSession", true);
capabilities.setCapability("ignoreZoomSetting", true);
capabilities.setCapability("ignoreProtectedModeSettings", true);
capabilities.setCapability("ignore-certificate-error", true);
capabilities.setCapability("capabilityType.ACCEPT_SSL_CERTS",
true);
Node = "http://xxx.xxx.x.xx:5554/wd/hub";
}
driver = new RemoteWebDriver(new URL(Node), capabilities);
driver.get(URL);
driver.manage().window().maximize();
}
}
}
public class A_Test extends TestBase {
...
}