How to start remote Safari Technology Preview from Selenese Runner Java

General Tech Technology & Software 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Technology & Software related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I have here a Selenium Hub and a Selenium Node with Config:

{
  "capabilities":
      [
        {
          "browserName": "safari",
          "version": "10",
          "maxInstances": 1,
          "webdriver.safari.driver": "/Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver"
        }
      ],

    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 1,
    "port": 5555,
    "register": true,
    "registerCycle": 5000,
    "hub": ":4444",
    "role": "node",
}

If I try to start a test from a Maven project with the code:

SafariOptions safariOptions = new SafariOptions();  
safariOptions.setUseTechnologyPreview(true);
safariOptions.setUseCleanSession(true);

DesiredCapabilities capabilities = DesiredCapabilities.safari();
capabilities.setCapability(SafariOptions.CAPABILITY, safariOptions);
RemoteWebDriver driver = new RemoteWebDriver(
    new URL("http://172.31.4.70:4444/wd/hub"), capabilities); 

System.out.println(capabilities.toString());
System.out.println(safariOptions.toJson().toString());

driver.manage().window().maximize();
driver.get("https://check24.de/kredit");


//Close the browser
driver.quit();

On the MAC, the Safari Technology Preview starts no problem. The Selenium Hub log:

14:02:03.874 INFO - Got a request to create a new session: Capabilities [{browserName=safari, safari.options={technologyPreview=true, port=0, cleanSession=true}, version=, platform=MAC}]
14:02:03.898 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, webdriver.safari.driver=/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver, browserName=safari, maxInstances=1, version=10, platform=MAC}

Now I'd like to start that with Selenese Runner Java with

java -jar C:\selenium\selenese-runner.jar --driver remote --remote-url http://:4444/wd/hub --remote-platform MAC --remote-browser "safari" --define "safari.options={technologyPreview=true, port=0, cleanSession=true}" --screenshot-on-fail C:\selenium\screenshot --max-time 600 --baseurl %1 %2

The log on the Seleniu Hub is the same:

14:05:26.088 INFO - Got a request to create a new session: Capabilities [{browserName=safari, safari.options={technologyPreview=true, port=0, cleanSession=true}, version=, platform=MAC}]
14:05:26.102 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, webdriver.safari.driver=/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver, browserName=safari, maxInstances=1, version=10, platform=MAC}

But a Safari (NOT Technology Preview) instante starts on the Selenium Node.

The different is that one send the safari.option with safariOption Class and one send it with plain text.

I cannot understand why there is defferent.

Have you any Idea?

Thanks!

Lian Shen

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.