How to start Appium server through robotframework by using process library or OperatingSystem.Run commands on Mac

1,994 views
Skip to first unread message

Uri Shatalov

unread,
Jul 20, 2015, 3:57:23 AM7/20/15
to robotframe...@googlegroups.com
ENV

Robot Framework 2.8.7 (Python 2.7.6 on darwin)

OS:OSX 10.1

using AppiumLibrary+processlibrary


i am able to invoke appium server manually from command line by using:

appium & command, but when trying to do the same through RF by using any of:


OperatingSystem.Run

Process.Run Process


the appium server will be up and running but the RIDE console will hang and will not proceed any further, so actual tests will not be executed

Tatu Aalto

unread,
Jul 20, 2015, 7:39:13 AM7/20/15
to Uri Shatalov, robotframework-users

Ugh

Have you tried with Start Process keyword:
http://robotframework.org/robotframework/latest/libraries/Process.html#Start%20Process

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Uri Shatalov

unread,
Jul 20, 2015, 8:13:53 AM7/20/15
to Tatu Aalto, robotframework-users
strange, nothing happens

Run killall node //this like is ok, it kills already running appium server
Process.Start Process appium & shell=true// nothing happens, i.e. appium server can't be invoked, console outputs nothing

without shell=true it through the following:

20150720 15:13:15.532 :  INFO : Running command 'killall node 2>&1'
20150720 15:13:15.541 :  INFO : 
Starting process:
['appium &']
20150720 15:13:15.549 :  FAIL : OSError: [Errno 2] No such file or directory
--
Thanks for collaboration and awareness

Best wishes and regards

Uri Shatalov

Tatu Aalto

unread,
Jul 20, 2015, 8:18:17 AM7/20/15
to Uri Shatalov, robotframework-users

Ugh

Remember to use the cwd parameter in the Start Processes keyword

-Tatu
Send from my mobile

CPLUS Jack

unread,
Jan 29, 2019, 6:09:21 PM1/29/19
to robotframework-users
在此輸入代碼...

在此輸入代碼...

Not sure still anyone who follow up this thread, basically it's easy, there are three things to do:
  1. Make sure there's no existed Appium process
  2. Start Appium server with Start Process keyword
  3. Stop Appium process
For the first one, we need to clean up all old Appium process, especially for iOS, Xcode will leave a build process in memory even if you have killed Appium process. To do so, using following command:
ps ef|grep appium|grep -v grep|awk '{print $2}'|xargs kill -9

You can package it as a keyword with Run Process keyword:
Process.Start Process  ${command}  shell=True  stdout=${CURDIR}/appium_kill_stdout.txt  stderr=${CURDIR}/appium_kill_stderr.txt
Sleep 10s

I also make it sleep 10s here because I found if you start Appium server right after it, it has chances to kill the new Appium process also.

Then it's easy, with Start Process keyword, give it an alias and input/output, especially input/output are required according to my test.
Start Process  /usr/local/bin/appium  -p  ${port}  shell=True  alias=appiumserver  stdout=${CURDIR}/appium_stdout.txt  stderr=${CURDIR}/appium_stderr.txt
Process Should Be Running  appiumserver
Sleep  10s
Also a 10s sleep here, to give it enough time to up&running

Finally, it's quite easy to stop the server with Terminate Process keyword.
Terminate Process  appiumserver  kill=True


Tatu Aalto於 2015年7月20日星期一 UTC+8下午8時18分17秒寫道:
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages