Safari test automation using Robot Framework via Jenkins I spent about one week trying to make my Robot Framework tests work for Safari browser in MacOS, when launched by Jenkins via ssh.

The main issue was that Robot couldn't open a browser when executed in ssh session, reporting "No browser is open".


MacOS 10.12.6 Sierra (issue was there also with 10.14 Mojave)
Safari 12.1.2 (issue was there also with Safari 10)
Robot Framework 3.1.2 (Python 3.6.8 / Python 2.7.16)


My current workaround is:


Application "robot_test" created (in Automator based on shell script type) which is to launch a shell script and save the exit code:


/tmp/execute_test.sh &gt; /tmp/execute_test.log 2&gt;&amp;1 
echo "export EXITCODE=$?" &gt; /tmp/execute_test.result



On the Jenkins side, in the shell command section, I am creating an shell script with the contents I need, execute it and wait for result file to appear:


export CURRENT_FOLDER=`pwd`
echo "#!/bin/bash
~/.bash_profile
cd $CURRENT_FOLDER
python3 -m robot -parameters robot_script.robot
" &gt; /tmp/execute_test.sh
chmod +x /tmp/execute_test.sh     
rm -f /tmp/execute_test.result
MAX_WAIT_TIME=1200
WAIT_TIME=0
open -a robot_test &gt; /tmp/robot_test_app.log 2&gt;&amp;1
while [ ! -f /tmp/execute_test.result ] &amp;&amp; [ $WAIT_TIME -le $MAX_WAIT_TIME ]; do
  WAIT_TIME=$((WAIT_TIME+10)); sleep 10
done
cat /tmp/execute_test.log

EXITCODE=1
if [ -f /tmp/execute_test.result ]; then
  chmod +x /tmp/execute_test.result
  source /tmp/execute_test.result
fi
exit $EXITCODE


Am I the only one having problems with running robot test from ssh sessions in MacOS? 
If yes, could you please share you steps to configure the proper setup?
If no, then this post might be helpful for someone to have working configuration at least, please share your solutions/workarounds if they are better.
Do you run selenium as a separate process?
I had the same issue if you are not running selenium in the background.

(edit)
Try java -jar selenium-XX.XX.jar in terminal.

After that run pabot or robot command to run the tests.
You can crate app through the Automator and use the same approach you describe to call it from the CI. That is what I end up using.