seleniumselenium-webdriverselenium-grid2

chrome browser is being launched eventhough firefox is configured as the browser in testng.xml


Trying to run parallel tests in chrome and firefox. During the execution another chrome browser is being launched instead of the firefox browser and it is being ignored. below are the versions of files being used OS - Ubuntu 16.04 LTS, Firefox version - 54, gecko version - v0.18, Chrome version -60.0.311, Chrome Driver - 2.53

testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="AutomationSuite" parallel="tests">
    <test name="TestCaratLaneInFireFox">
        <parameter name="node" value="http://*******:4444/wd/hub"/>
        <parameter name="browser" value="Firefox"/>
        <packages>
            <package name="script"/>
        </packages>
    </test>
    <test name="TestCaratLaneInChrome">
        <parameter name="node" value="http://****:4444/wd/hub"/>
        <parameter name="browser" value="chrome"/>
        <packages>
            <package name="script"/>
        </packages>
    </test>
</suite>

BaseTest.Java

public class BaseTest implements IAutoConst {

    public WebDriver driver;

    static {    
        System.setProperty(CHROME_KEY, CHROME_VALUE);
        System.setProperty(GECKO_KEY, GECKO_VALUE);
    }

    @Parameters({"node","browser"})
    @BeforeMethod
    public void openApplication(String node,String browser) throws MalformedURLException {

        // ChromeOptions options = new ChromeOptions();
        // options.addArguments("--disable-notifications"); 
        URL system = new URL(node);
        DesiredCapabilities whichBrowser = new DesiredCapabilities();
        whichBrowser.setBrowserName(browser);
        driver = new RemoteWebDriver(system,whichBrowser);
        driver.get(URL);        
        driver.manage().timeouts().implicitlyWait(ITO, TimeUnit.SECONDS);
        //driver.manage().window().maximize();
    }

    @AfterMethod
    public void closeApplication() {
        driver.close();
    }
}

Emailable Report: Report


Solution

  • Gecko driver version which was kept in hub had a different version than in the node. Hence it stopped the Firefox from launching.