<p>Do you run selenium as a separate process?<br>
I had the same issue if you are not running selenium in the background.</p>

<p>(edit)
Try java -jar selenium-XX.XX.jar in terminal.</p>

<p>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.</p>

CC BY-SA 4.0
2019-12-05T15:51:47.997Z
Please add the commands you were running.
030
CC BY-SA 4.0
2019-12-04T18:49:09.097Z
2019-12-12T09:36:20.883Z
2019-12-12T09:36:20.883Z
Tsvetan Tsvetkov
<p>I spent about one week trying to make my Robot Framework tests work for Safari browser in MacOS, when launched by Jenkins via ssh.</p>

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

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

<p>My current workaround is:</p>

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

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

<ol start="2">
<li>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:</li>
</ol>

<pre><code>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
</code></pre>

<p>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.</p>

CC BY-SA 4.0
2019-11-06T08:42:56.960Z
Ok, just for everyone's info - the issue is gone after upgrading to the latest MacOS Catalina (10.15).
There are some new problems with newer Safari, but it is another story :)
Vladimir T
<jenkins><testing><macos>
Safari test automation using Robot Framework via Jenkins
Vladimir T
# Safari test automation using Robot Framework via Jenkins

(Asked by: username_0 on 2019-10-14)

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 > /tmp/execute_test.log 2>&1 
echo "export EXITCODE=$?" > /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
" > /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 > /tmp/robot_test_app.log 2>&1
while [ ! -f /tmp/execute_test.result ] && [ $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.

**Tags:** jenkins, testing, macos

> **Comments:**
> **username_0**: Ok, just for everyone's info - the issue is gone after upgrading to the latest MacOS Catalina (10.15). There are some new problems with newer Safari, but it is another story :)  

---

## 1 answers

### Answer by username_1 on 2019-12-04. Score: 1

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.

> **Comments:**
> **username_2**: Please add the commands you were running.  

---

