taobao-iphone-device sleep 60秒后,出现A session is either terminated or not started

oxf4rvwz  于 2022-10-25  发布在  其他
关注(0)|答案(1)|浏览(258)

python+appium iOS APP自动化

代码中有个语句 time.sleep(60) ,60秒后,代码往后运行就出现错误

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\_pytest\main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\_pytest\main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\_pytest\main.py", line 348, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\_pytest\runner.py", line 109, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\_pytest\runner.py", line 126, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\_pytest\runner.py", line 217, in call_and_report
INTERNALERROR>     report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\pluggy\callers.py", line 203, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "D:\code\eufy_security_smoke\src\case\conftest.py", line 671, in pytest_runtest_makereport
INTERNALERROR>     screenshot_html = save_screenshot(path, html_path, name)
INTERNALERROR>   File "D:\code\eufy_security_smoke\src\case\conftest.py", line 780, in save_screenshot
INTERNALERROR>     get_screenshot(driver, path_name)   # 兼容h5截图
INTERNALERROR>   File "D:\code\eufy_security_smoke\src\case\conftest.py", line 705, in get_screenshot
INTERNALERROR>     current_c = driver.current_context
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\appium\webdriver\extensions\context.py", line 52, in current_context
INTERNALERROR>     return self.execute(Command.GET_CURRENT_CONTEXT)['value']
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
INTERNALERROR>     self.error_handler.check_response(response)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\appium\webdriver\errorhandler.py", line 31, in check_response
INTERNALERROR>     raise wde
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\appium\webdriver\errorhandler.py", line 26, in check_response
INTERNALERROR>     super().check_response(response)
INTERNALERROR>   File "D:\code\eufy_security_smoke\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
INTERNALERROR>     raise exception_class(message, screen, stacktrace)
INTERNALERROR> selenium.common.exceptions.WebDriverException: Message: A session is either terminated or not started

我又在macOS中跑了一下, time.sleep(60) 并没有影响代码的往后运行。
所以不知道是 tidevice 的问题,还是我环境的问题?

相关问题