1

我正在通过终端通过命令启动 appium 服务器,appium并在另一个终端中运行我的测试套件python test.py这工作正常。但是如果通过 python 脚本启动,我会在 2 个测试之间出现错误

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

错误: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.

错误没有影响测试仍然通过

我尝试在拆解中添加 killall 节点

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

但它给了我错误

OSError: [Errno 2] No such file or directory

如何摆脱错误并停止 appium 服务器?

通过启动应用程序调用设置->单击一些按钮->通过关闭应用程序调用拆卸

4

0 回答 0