1

I am launching appium server through terminal by command appium and in another terminal I run my test suite python test.py This works fine. But if launch through python script I get error between 2 tests

def setup(self):
        subprocess.Popen('appium', shell=False)
        time.sleep(5)
        desired_caps = dict()
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '6.0'
        desired_caps['deviceName'] = 'Android Emulator'
        desired_caps['app'] = os.path.abspath('test.apk')
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
        return self.driver

error: Couldn't start Appium REST http interface listener. Requested port is already in use. Please make sure there's no other instance of Appium running already.

The error has no effect tests still pass

I tried adding killall node in teardown

def tearDown(self, driver):
    self.driver = driver
    self.driver.quit()
    subprocess.Popen('killall node', shell=False) 

but it gives me error

OSError: [Errno 2] No such file or directory

How can I get rid of error and stop appium server?

Setup is called through launch app -> click some buttons -> call teardown through close app

user2661518
  • 2,677
  • 9
  • 42
  • 79
  • 1
    I don't know what is `appium` but you could `self.appium = subprocess.Popen('appium'); assert self.appium.poll() is None # running` and add `self.appium.terminate(); self.appium.wait();` in `tearDown()` or use some other method to stop `appium` process. – jfs Oct 16 '15 at 12:40
  • self.appium.terminate() worked ! – user2661518 Oct 28 '15 at 17:16

0 Answers0