0
votes

i am trying to kill process in robot framework, although the log says that process is killed , i am still able to see the command prompt invoked by the process Library.

is there anyway to kill the invoked command prompt in Suite Teardown ?

*** Settings ***
Library    Process
Suite Setup    Generic Suite Setup
Suite TearDown    Terminate All Processes    kill=True
*** Test Cases ***
login
*** Keywords ***
Generic Suite Setup
    #This is invoking cmd 

    #when i run this , got error as mentioned below 
    Run Process    appium    -p     4723

    Run Process    appium    -p     4750

    #I tried to include cmd , no error but can't see the cmd getting invoked 
    Run Process    cmd    appium    -p     4750

My python version :2.7.14 pybot version : 3.0.2

After removing start & "cmd" i get the error

Parent suite setup failed: WindowsError: [Error 2] The system cannot find the file specified

Appium path is set in environment variables

1
Did you start those process via the Process Library?Goralight
Yes, I am using Process library.pankaj mishra
Right, sorry. I miss understood what your code was doing. Have you tried the keyword Terminate Process? robotframework.org/robotframework/latest/libraries/… - It seems that you have, under the Terminate All Processes, can you show us that?Goralight
sorry i did n't understand your question? i have used Terminate process , it did n't worked.pankaj mishra
Why are you starting cmd and having cmd start appium? Why not just directly start appium?Bryan Oakley

1 Answers

0
votes

When you use Start Process, each argument that you would use on a command line needs to be an argument in robot. For example, if you would type appium -p 4723 on the command line, then in robot you would do:

Start process  appium  -p  4723

(note: there are two spaces between "process", "appium", "-p", and "4723")

When you do this, robot will look through the folders in your PATH environment variable in order to find a program named "appium" (or "appium.exe" on windows). If you get the error "cannot find the file specified" that usually means that the program you're trying to run isn't in a folder in your PATH. It could also mean that the program isn't installed, or that you misspelled the app name, but I'm assuming neither of those are true in this case.

The simplest solution is to find where the appium executable is, and then use the full and complete path as the first argument to Run Process (eg: Run Process C:/the/path/to/appium.exe -p 4723)