0

Details:

Windows version: 10 , 64 bit

MAC: macOS Sierra 10.12.5

Safari: 10.1.1

Selenium: 3.4.0

Started hub on Windows machine with below command and successfully started

java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4444

Started node on MAC machine with below command and successfully started

java -jar selenium-server-standalone-3.4.0.jar -role node -nodeConfig mac.json

mac.json content is

{
  "capabilities":
  [
    {
      "browserName": "safari",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "firefox",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "chrome",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "internet explorer",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://192.101.3.23:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {}
}

Selenium Java code to invoke browser is

capability = DesiredCapabilities.safari();
capability.setBrowserName("safari");
capability.setPlatform(Platform.MAC);
SafariOptions options = new SafariOptions();
options.setUseCleanSession(true);
capability=DesiredCapabilities.safari();
capability.setCapability(SafariOptions.CAPABILITY, options);
capability.setPlatform(Platform.ANY);

driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);

On executing the below line for Safari browser

driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);

Throwing an exception

java.lang.reflect.InvocationTargetException

I am unable to proceed to, did i missed anything, what is not allowing me to proceed further, can any one help please.

Updated the Selenium Java code as below, and is working fine

capability = DesiredCapabilities.safari();
driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);
SeJaPy
  • 284
  • 1
  • 6
  • 18

2 Answers2

1

Updated Java code as below to invoke browser, and is working fine

capability = DesiredCapabilities.safari();
driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);
SeJaPy
  • 284
  • 1
  • 6
  • 18
0

Do you call the Mac-Node directly in your tests?

I did not test it, but if i understand it correctly you have to call the hub. And then the hub manages the dispatching to the nodes.

So your call should be something like:

driver=new RemoteWebDriver(new URL(http://192.101.3.23:4444/wd/hub),capability);
Benjamin Schüller
  • 2,104
  • 1
  • 17
  • 29
  • Thanks for the response. Defined capabilities in mac.json and in Java code cause the issue, removed capabilities in Java code and is working fine. – SeJaPy Aug 08 '17 at 12:18
  • @Aparna - You might want to answer your question and then accept it as well, so that the question can get closed. – Krishnan Mahadevan Aug 10 '17 at 03:32