Unable to run tests against Safari 11 remotely (ssh, CI)

你。 提交于 2019-12-01 22:52:27

There is a possible workaround to do this. First you need to create a Automator Workflow or Apple Script that launches the SafariDriver

Then save this as a application. Let assume we name it SafariDriver7050.

Then from the SSH session you need to execute

open /Applications/SafariDriver7050.app

This will actually launch SafariDriver in the logged in session and it should work for you.

The caveat being shutting it down, you will need to first kill the SafariDriver7050 app and then you need to kill the safaridriver process. The order matters, else it will create a error dialog on UI

Edit-1:

As you suggested, it would be even easier to do this, when you wrap your test as a app and then it will be automatically be able to launch SafariDriver without any issues. The key to issue is using open command in a SSH session

Edit-2

Why does SafariDriver not work in SSH? Well if you look at the linux counterpart

In case of linux we can use the DISPLAY environment variable to launch an app in an existing display or we can use something like XVFB to launch the browser in a virtual display. That is the concept that most frameworks use in case of linux machines.

But Mac doesn't have such kind of feature, which is why this workaround is needed. Now why it doesn't have that, I am not sure. There may be some other workaround that I may not be aware of, so anyone who has valuable info, can help improve this part of the answer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!