Selenium: Selenium 3.4.0 -Java : Selenium 3.4.0 does not works with Grid Configuration

Created on 29 Apr 2017  路  9Comments  路  Source: SeleniumHQ/selenium

Meta -

OS:
Windows 8
Selenium Version:
3.4.0
Browser:
Mozila Firefox

Browser Version:
53.0 (64-bit)

Expected Behavior -

Selenium 3.4.0 (Java) should open Mozila Firefox browser with success.

Actual Behavior -

Selenium 3.4.0 (Java) while attempting to open Mozila Firefox browser throws org.openqa.selenium.WebDriverException.

Steps to reproduce -

webdriverexception

seleniumgridconfig

Code Snippet:

package SeleniumGrid;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;

public class testFirefoxonGrid 
{

    @Test
    public void test1() throws MalformedURLException
    {

        System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
        DesiredCapabilities cap = DesiredCapabilities.firefox();
        cap.setBrowserName("firefox");
        cap.setCapability("marionette", true);
        cap.setPlatform(Platform.WINDOWS);
        URL url = new URL("http://localhost:4444/wd/hub");
        WebDriver driver = new RemoteWebDriver(url, cap);
        driver.get("http://google.com/");
        System.out.println("Title is : "+driver.getTitle());
        driver.quit();

    }
}

Most helpful comment

@debanjan-selenium you need to point the node to the geckodriver installation on the node, like this;

java -Dwebdriver.gecko.driver={path-to-geckodriver-exe} -jar selenium-server-standalone-3.4.0.jar -role node -hub http://{hubHost}:{hubPort}/grid/register

All 9 comments

The server (grid node) needs to be started with the system property -- not the client.

@mach6 Can you please elaborate a bit more what else I need to do to start server (grid node) apart from doing this:

>java -jar C:\Utility\selenium-server-standalone\selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register

I don't see any error either in the console while starting :

C:\Users\AtechM_03>java -jar C:\Utility\selenium-server-standalone\selenium-serv
er-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register
20:52:34.618 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
20:52:34.619 INFO - Launching a Selenium Grid node
2017-05-03 20:52:35.581:INFO::main: Logging initialized @1323ms to org.seleniumh
q.jetty9.util.log.StdErrLog
20:52:35.647 INFO - Driver class not found: com.opera.core.systems.OperaDriver
20:52:35.647 INFO - Driver provider com.opera.core.systems.OperaDriver registrat
ion is skipped:
Unable to create new instances on this machine.
20:52:35.648 INFO - Driver class not found: com.opera.core.systems.OperaDriver
20:52:35.649 INFO - Driver provider com.opera.core.systems.OperaDriver is not re
gistered
20:52:35.650 INFO - Driver provider org.openqa.selenium.safari.SafariDriver regi
stration is skipped:
 registration capabilities Capabilities [{browserName=safari, version=, platform
=MAC}] does not match the current platform WIN8
2017-05-03 20:52:35.711:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-05-03 20:52:35.767:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletC
ontextHandler@1f0f1111{/,null,AVAILABLE}
2017-05-03 20:52:35.796:INFO:osjs.AbstractConnector:main: Started ServerConnecto
r@453ee9cc{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2017-05-03 20:52:35.797:INFO:osjs.Server:main: Started @1539ms
20:52:35.797 INFO - Selenium Grid node is up and ready to register to the hub
20:52:35.822 INFO - Starting auto registration thread. Will try to register ever
y 5000 ms.
20:52:35.822 INFO - Registering the node to the hub: http://localhost:4444/grid/
register
20:52:36.049 INFO - The node is registered to the hub and ready to use
20:52:41.379 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and c
lientGoneTimeout 1800000 polling every 180000

@debanjan-selenium you need to point the node to the geckodriver installation on the node, like this;

java -Dwebdriver.gecko.driver={path-to-geckodriver-exe} -jar selenium-server-standalone-3.4.0.jar -role node -hub http://{hubHost}:{hubPort}/grid/register

@mach6 That worked like a magic. Thanks a ton.

@debanjan-selenium So what did you exactly change in your code? I am having the same trouble but i did not understand the solution.

@umerShak I configured the Node as per @mach6 instruction. It's working fine now. Incase you are stuck I may need to see the way you are configuring the Hub & Node along with your code block. You may consider raising a question on stackoverflow.com & mark me in a comment. I will address your Question at the earliest. Thanks

@umerShak my handle on stackoverflow.com is DebanjanB thanks

Hi Guys ,
I am using selenium-server-standalone-3.4.0 with FirefoxVersion of 54 (32 bit ) and it seems that the firefox browser is opened by selenium grid but its not able to navigate and perform any action . I am using the below cli command to fire up node :

java -Dwebdriver.gecko.driver="C:UsersDebarnabCucumberPOMgeckodriver.exe" -jar selenium-server-standalone-2.53.0.jar -role node -nodeConfig nodeconfig.json

Is there anything else that needs to be done for firefox 54 and selenium-server-standalone-3.4.0
It shows me the following error after few seconds of waiting .

Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
s":[],"hasEmbeddedWebExtension":false,"userPermissions":null}

Please suggest

@debarnabbanerjee, you are still referencing 2.53.0 in your node cli. You need to update the selenium-server-standalone jar on the node to 3.4.0 as well and change your cli script to:

java -Dwebdriver.gecko.driver="C:UsersDebarnabCucumberPOMgeckodriver.exe" -jar selenium-server-standalone-3.4.0.jar -role node -nodeConfig nodeconfig.json

Was this page helpful?
0 / 5 - 0 ratings