Tuesday, May 29, 2012

Use firefox in custom location for Grid

Start Node 

java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://IP_Remote_Machine:4444/grid/register -port 5561 -nodeConfig config.txt

config.txt File Contents

{
"capabilities":
        [
                {
                        "browserName":"firefox",
                        "acceptSslCerts":true,
                        "javascriptEnabled":true,
                        "takesScreenshot":true,
                        "firefox_binary":"c:\\Program Files\\FF9\\firefox.exe",
                        "maxInstances":5,
                        "version":"9"
                },
                {
                        "browserName":"chrome",
                        "maxInstances":5
                },
                {
                        "browserName":"internet explorer",
                        "platform":WINDOWS
                }
        ],
"configuration":
        {
                "cleanUpCycle":2000,
                "proxy":"org.openqa.grid.selenium.proxy.WebDriverRemoteProxy",
                "maxSession":5,
                "port": 5561,
                "hubPort" : 4444
        }
}

The above script will assigned firefox 9 installed in custom location to grid hub.

Java Code For Assigning Browser

DesiredCapabilites caps = new DesiredCapabilites.firefox();
caps.setVersion("9");
caps.setBrowserName("firefox");
caps.setPlatform(Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:444/wd/hub"), caps);


No comments:

Post a Comment