Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run Safari Technology Preview with Selenium standalone server #6791

Closed
cuki opened this issue Dec 27, 2018 · 3 comments
Closed

Unable to run Safari Technology Preview with Selenium standalone server #6791

cuki opened this issue Dec 27, 2018 · 3 comments
Labels

Comments

@cuki
Copy link

cuki commented Dec 27, 2018

🐛 Bug Report

According to this commit (6e09f51) you should be able to switch between Safari and Safari Technology Preview by using the respective browser name ("Safari Technology Preview").

return SAFARI_TECH_PREVIEW.equals(getBrowserName()) ||

It seems whatever you specify as capabilities is discarded and reset upon creation of new SafariOptions instance:

public SafariOptions() {
setUseTechnologyPreview(false);
setCapability(BROWSER_NAME, "safari");
}

Simply put, it does not respect the specified browserName value.

To Reproduce

  1. Enable safaridriver
/usr/bin/safaridriver --enable
  1. Start Selenium standalone server
selenium-standalone start
  1. Initiate new session with "Safari Technology Preview"
curl -d '{ "capabilities": { "alwaysMatch": { "browserName": "Safari Technology Preview" }, "firstMatch": [ {} ] }, "desiredCapabilities": { "browserName": "Safari Technology Preview" } }' http://localhost:4444/wd/hub/session

Logs

org.openqa.selenium.SessionNotCreatedException: Unable to create session from {
  "desiredCapabilities": {
    "browserName": "Safari Technology Preview"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "Safari Technology Preview"
      }
    ]
  }
}
Build info: version: '3.141.0', revision: '2ecb7d9a', time: '2018-10-31T20:22:52'
System info: host: 'MBP', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_131'
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:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

Expected behavior

Upon specifying "Safari Technology Preview" as browserName when running Selenium standalone server, it should utilize the corresponding safaridriver executable located within the Technology Preview application.

Environment

OS: macOS High Sierra 10.13.6
Browser: Safari
Browser version: Technology Preview release 72 (12.1, 13607.1.17.1)
Browser Driver version:
Language Bindings version: Standalone server 3.141.59

Additional context

As alternative there is the deprecated safari.options.technologyPreview (desired) capability which does work, however does not comply with W3C standard for capabilities, unlike the previously removed vendor-prefixed se:safari:techPreview capability.

This imposes a problem when using an implementation to communicate with Selenium, which has strict compliance with W3C standard (e.g. webdriverio) and/or does not allow you to specify desiredCapabilities different than capabilities.

@titusfortner
Copy link
Member

fwiw, this is what I'm currently getting when passing in to the grid built from trunk:

2020-07-11 12:14:33 INFO Selenium -> POST session
2020-07-11 12:14:33 INFO Selenium >>> http://127.0.0.1:4445/wd/hub/session | {"capabilities":{"firstMatch":[{"browserName":"Safari Technology Preview","platformName":"mac"}]}}
2020-07-11 12:14:34 INFO Selenium <- {
"value": {
"error": "session not created",
"message": "Unable to create session for \u003cCreateSessionRequest with Capabilities {browserName: Safari Technology Preview, platformName: mac}>\nBuild info: version: '4.0.0-alpha-7', revision: 'b93eab6f3a*'\nSystem info: host: 'SL-1495.local', ip: '2601:1c0:5200:2640:0:0:0:89cf%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.5', java.version: '11.0.6'\nDriver info: driver.version: unknown",

@shs96c
Copy link
Member

shs96c commented Jul 21, 2020

So, this boils down to the way that we configure the server. Right now, the LocalNodeFactory is the place where things get wired up. This looks up every instance of DriverService.Builder via ServiceLoader. By default, the Safari implementation of this uses the regular Safari and not the Tech Preview.

We have two choices:

  1. Break out two instances of the builder, one for Safari, and one for the Tech Preview
  2. Change how we wire up the node in the first place, and use some kind of Function<Capabilities, WebDriver> instead of what we're doing now.

I think the second is neater, but the first is a lot easier to do :)

@diemol diemol closed this as completed in 184ac78 Sep 27, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants