0

I'm trying to do a basic test using Selenium Grid to start Safari on a MacOS.

I have registered the node and its appears in my hub as the following.

Hub Confirmating node is up

  • browserTimeout: 0
  • debug: false
  • host: 10.120.45.211
  • port: 5558
  • role: node
  • timeout: 1800
  • cleanUpCycle: 5000
  • maxSession: 5
  • capabilities: Capabilities {browserName: Safari, maxInstances: 1, platform: MAC, platformName: MAC, seleniumProtocol: WebDriver, server:CONFIG_UUID: 1ba7b7b4-556c-430a-ab84-157...}
  • downPollingLimit: 2
  • hub: http://10.120.45.245:4444/grid/register
  • id: http://10.120.45.211:5558
  • nodePolling: 5000
  • nodeStatusCheckTimeout: 5000
  • proxy: org.openqa.grid.selenium.proxy.DefaultRemoteProxy
  • register: true
  • registerCycle: 5000
  • remoteHost: http://10.120.45.211:5558
  • unregisterIfStillDownAfter: 60000

I understand that SafariDriver is now available directly within macOS and i'm using these steps to make sure it setup correctly.

If you haven’t already done so, make the Develop menu available. Choose Safari > Preferences, and on the Advanced tab, select “Show Develop menu in menu bar.” For details, see Safari Help. Choose Develop > Allow Remote Automation. Authorize safaridriver to launch the XPC service that hosts the local web server. To permit this, manually run /usr/bin/safaridriver once and follow the authentication prompt.

This is my JAVA code:

package SeleniumGrid;

import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class SafariRemoteAccess {

    public static void main(String[] args) throws MalformedURLException {

        DesiredCapabilities dc = new DesiredCapabilities();
        dc.setBrowserName("Safari");

        //Point to hub
        WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);

        // Go to website via NODE
        driver.get("https://www.hsbc.co.uk/");
        driver.quit();
    }
}

When I run the program i getting the following message.

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create session from {
  "desiredCapabilities": {
    "browserName": "Safari",
    "server:CONFIG_UUID": "1ba7b7b4-556c-430a-ab84-1574fc7ea584"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "Safari",
        "server:CONFIG_UUID": "1ba7b7b4-556c-430a-ab84-1574fc7ea584"
      }
    ]
  }
}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Mishal-Shahs-MacBook-Pro.local', ip: 'fe80:0:0:0:c9b:214f:9f0:2788%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_202'
Driver info: driver.version: unknown
Command duration or timeout: 198 milliseconds**
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54)
    at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
    at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
    at SeleniumGrid.SafariRemoteAccess.main(SafariRemoteAccess.java:17)
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create session from {
  "desiredCapabilities": {
    "browserName": "Safari",
    "server:CONFIG_UUID": "1ba7b7b4-556c-430a-ab84-1574fc7ea584"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "Safari",
        "server:CONFIG_UUID": "1ba7b7b4-556c-430a-ab84-1574fc7ea584"
      }
    ]
  }
}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Mishal-Shahs-MacBook-Pro.local', ip: 'fe80:0:0:0:c9b:214f:9f0:2788%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_202'
Driver info: driver.version: unknown
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'LAPTOP-1MOS5JFR', ip: '10.120.45.245', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_192'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$4(NewSessionPipeline.java:76)
    at java.util.Optional.orElseThrow(Optional.java:290)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$5(NewSessionPipeline.java:75)
    at java.util.Optional.orElseGet(Optional.java:267)
    at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession(NewSessionPipeline.java:73)
    at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute(BeginSession.java:65)
    at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0(WebDriverServlet.java:235)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Update

This is the code im using to setup the NODE on the MacOS machine:

java -Dwebdriver.safari.driver=/System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub 10.120.45.245:4444/grid/register -port 5558 -browser "browserName=Safari, platform=MAC, platformName=MAC, maxInstances=1"
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

It is not clear from your error stack trace if the Selenium Grid is on Mac OS X and to start the Selenium Node you are using the command:

java -Dwebdriver.safari.driver=/System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub 10.120.45.245:4444/grid/register -port 5558 -browser "browserName=Safari, platform=MAC, platformName=MAC, maxInstances=1"

why would you see the error log as (relates to Selenium Grid):

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Mishal-Shahs-MacBook-Pro.local', ip: 'fe80:0:0:0:c9b:214f:9f0:2788%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_202'
Driver info: driver.version: unknown

Then again (first set relates to Mac OS X and second set relates to Windows 10):

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Mishal-Shahs-MacBook-Pro.local', ip: 'fe80:0:0:0:c9b:214f:9f0:2788%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_202'
Driver info: driver.version: unknown
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'LAPTOP-1MOS5JFR', ip: '10.120.45.245', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_192'
Driver info: driver.version: unknown

However the command you have used to initiate the Selenium Grid Node is error prone as it contains both:

  • platform=MAC
  • platformName=MAC

Assuming the Selenium Grid Node is being initiated from the Windows 10 box the command should be:

java -Dwebdriver.safari.driver=C:\path\to\safaridriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -hub 10.120.45.245:4444/grid/register -port 5558 -browser "browserName=safari, platform=WINDOWS, maxInstances=1"

Note: Ensure Safari browser is installed within the Windows 10.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352