Safari: не удается установить новый сеанс

macOS: версия 10.13.4

Safari: версия 11.1

Автономный Selenium: версия: 6.14.1


Вывод: я получаю сообщение «Не удается установить новый сеанс» в журналах драйвера при запуске автоматизации на экземпляре selenium-standalone, который был запущен через SSH.

Примечание. Если вы запускаете selenium-standalone непосредственно на компьютере Mac без использования SSH, все работает отлично.

Действия для воспроизведения:

1) SSH на устройство Mac.

2) запустить селен-автономный

команда: selenium-standalone start -- -role node -nodeConfig safari.json

safari.json:

{
  "capabilities":
  [
    {
      "browserName": "safari",
      "platform": "MAC",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 1,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://ReplaceWithHubUrl:4449",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "host":"ReplacewithNodeIP",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {}
}

3) Запускаем автоматику (конечно указали в сторону хаба)

журналы селенового сервера:

12:12:41.490 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
12:12:41.491 INFO - Launching a Selenium Grid node
2018-05-24 12:12:44.846:INFO::main: Logging initialized @3650ms to org.seleniumhq.jetty9.util.log.StdErrLog
12:12:44.871 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
12:12:44.877 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
12:12:44.879 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
12:12:44.879 INFO - Driver class not found: com.opera.core.systems.OperaDriver
12:12:44.879 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
12:12:44.880 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
12:12:44.880 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
12:12:44.890 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: } does not match the current platform MAC
12:12:44.890 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities {browserName: MicrosoftEdge, platform: WINDOWS, version: } does not match the current platform MAC
12:12:44.911 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
12:12:44.911 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
12:12:44.911 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
12:12:44.912 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
12:12:44.912 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
12:12:44.917 INFO - Using the passthrough mode handler
2018-05-24 12:12:44.934:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-05-24 12:12:44.950:WARN:osjs.SecurityHandler:main: [email protected]@ba54932{/,null,STARTING} has uncovered http methods for path: /
2018-05-24 12:12:44.953:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@ba54932{/,null,AVAILABLE}
2018-05-24 12:12:44.971:INFO:osjs.AbstractConnector:main: Started ServerConnector@d6e7bab{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2018-05-24 12:12:44.971:INFO:osjs.Server:main: Started @3775ms
12:12:44.971 INFO - Selenium Grid node is up and ready to register to the hub
12:12:44.976 INFO - Starting auto registration thread. Will try to register every 5000 ms.
12:12:44.976 INFO - Registering the node to the hub: http://qa-docker02.avirat.net:4449/grid/register
12:12:44.987 INFO - The node is registered to the hub and ready to use
Selenium started
2018-05-24 12:12:49.235:INFO:osjshC.ROOT:qtp782378927-10: org.openqa.selenium.remote.server.WebDriverServlet-5e5d171f: Initialising WebDriverServlet
12:12:49.249 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@5452a53c
12:12:49.251 INFO - /session: Executing POST on /session (handler: BeginSession)
12:12:49.295 INFO - Capabilities are: Capabilities {browserName: safari}
12:12:49.297 INFO - Capabilities {browserName: safari} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.safari.SafariDriverService)

Журналы драйверов:

org.openqa.selenium.SessionNotCreatedException: Cannot establish new session
    Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
    System info: host: 'qa01.avirat.net', ip: 'fe80:0:0:0:1854:3678:a42:3622%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.4', java.version: '1.8.0_121'
    Driver info: driver.version: unknown
    Command duration or timeout: 52.01 seconds
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            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$new$0(JsonWireProtocolResponse.java:53)
            at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
            at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
            at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
            at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
            at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
            at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
            at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
            at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
            at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
            at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
            at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
            at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
            at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
            at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
            at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
            at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:132)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:145)
            at cucumber.driver.Factory.createDriver(Factory.java:29)
            at cucumber.support.Hooks.beforeScenario(Hooks.java:59)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at cucumber.runtime.Utils$1.call(Utils.java:31)
            at cucumber.runtime.Timeout.timeout(Timeout.java:16)
            at cucumber.runtime.Utils.invoke(Utils.java:25)
            at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
            at cucumber.runtime.HookDefinitionMatch.runStep(HookDefinitionMatch.java:17)
            at cucumber.runner.UnskipableStep.executeStep(UnskipableStep.java:22)
            at cucumber.api.TestStep.run(TestStep.java:83)
            at cucumber.api.TestCase.run(TestCase.java:58)
            at cucumber.runner.Runner.runPickle(Runner.java:80)
            at cucumber.runtime.Runtime.runFeature(Runtime.java:119)
            at cucumber.runtime.Runtime.run(Runtime.java:104)
            at cucumber.api.cli.Main.run(Main.java:36)
            at cucumber.api.cli.Main.main(Main.java:18)

Журналы Selenium Hub

starting selenium hub with configuration:
{
  "host": null,
  "port": 4444,
  "role": "hub",
  "maxSession": 50,
  "newSessionWaitTimeout": 120000,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "jettyMaxThreads": -1,
  "cleanUpCycle": 60000,
  "browserTimeout": 60000,
  "timeout": 90000,
  "debug": false
}
19:33:36.875 INFO - Selenium build info: version: '3.7.1', revision: '8a0099a'
19:33:36.878 INFO - Launching Selenium Grid hub
2018-05-24 19:33:37.883:INFO::main: Logging initialized @2333ms to org.seleniumhq.jetty9.util.log.StdErrLog
19:33:37.914 INFO - Will listen on 4444
2018-05-24 19:33:38.014:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2018-05-24 19:33:38.081:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2018-05-24 19:33:38.081:INFO:osjs.session:main: No SessionScavenger set, using defaults
2018-05-24 19:33:38.089:INFO:osjs.session:main: Scavenging every 600000ms
2018-05-24 19:33:38.107:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@57d5872c{/,null,AVAILABLE}
2018-05-24 19:33:38.154:INFO:osjs.AbstractConnector:main: Started ServerConnector@1f1c7bf6{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-05-24 19:33:38.155:INFO:osjs.Server:main: Started @2605ms
19:33:38.155 INFO - Nodes should register to http://10.255.1.238:4444/grid/register/
19:33:38.155 INFO - Selenium Grid hub is up and running
19:33:39.082 INFO - Registered a node http://10.57.85.10:5555
19:34:08.364 INFO - Got a request to create a new session: Capabilities {browserName: safari}
19:34:08.365 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, technologyPreview=false, se:CONFIG_UUID=c82e2553-dfdf-409c-8028-c76da8352368, browserName=safari, maxInstances=1, platform=MAC}

person Rlupo07    schedule 24.05.2018    source источник


Ответы (1)


С High Sierra мне пришлось указать конкретную версию ОС в платформе, а также версию сафари следующим образом (в JS против Java, но тот же принцип):

"safari": {
  "browserName": "safari",
  "platform": "macOS 10.13",
  "version": "11.0",
  "port": 4444
}, 

Если это не решит проблему, у пользователя, с которым вы работаете на Mac, к которому вы подключаетесь по SSH, может не быть достаточных разрешений для запуска драйвера.

person aaronbriel    schedule 24.05.2018