Search code examples
robotframeworksafaridriver

RobotFramework - WebDriverException: Message: Service /usr/bin/safaridriver unexpectedly exited. Status code was: 1


I'm using Robot Framework to execute some tests on the products of the society I'm working in. Actually, my tests are running on a macOS machine. I can remotely launch tests on firefox and chrome and everything works fine. When I'm trying to launch the same test remotely on Safari I get this error :

WebDriverException: Message: Service /usr/bin/safaridriver unexpectedly exited. Status code was: 1

I checked the console and these errors come out when the machine tries to launch the safaridriver :

authd         Fatal: interaction not allowed (kAuthorizationFlagInteractionAllowed not set)
safaridriver  Authorization failed with error -60007.
authd         copy_rights: authorization failed

What I already tried: I allowed remote automation on the safari browser and launched this as the user executing the tests :

sudo safaridriver --enable

Moreover, if I connect in Screen Sharing with the macOS machine and reproduce the exact behavior manually, everything is working fine and test is launched on Safari Browser. To launch the tests remotely I use a Tomcat server.

Here are the versions of the tools I use : Python 2.7.16 Selenium 3.141.0 Robotframework 3.0.2 macOS Mojave 10.14.6 Safari 14.0.1 (14610.2.11.51.10) (safaridriver is bundled with it)

I would like these tests to launch remotely exactly as on firefox or chrome, I've already looked many other questions here but I didn't find any solution. I'm new with working on macOS so there must be something I'm missing about how to authorize processes on Mac, any help would be appreciated.


Solution

  • I found a solution to the problem and I'm posting it here so if anyone has the same trouble can try this.

    The solution was that my Tomcat Server was launched by a system user that doesn't have display rights so when I restarted the server with a user that have these rights (basic user account) the safaridriver could be launched and it worked fine.

    The fact that it was only a problem related to safaridriver is that now safaridriver comes bundled with Safari so I guess Mac add this kind of protection to their own binaries.