嗨,我需要通过python运行appium,因为我正在使用AppiumService,但收到nodeJs错误。 作业系统版本:Windows 10 代码:
import logging
from appium.webdriver.appium_service import AppiumService
logger = logging.getLogger('framework')
class Mobile_adapter:
def __init__(self):
self._appium_Service = AppiumService()
self.active_Server = None
def start_Server(self):
"""initiates appium server and returns it's status as true or false"""
self._appium_Service.start()
status = self._appium_Service.is_running
return status
def kill_server(self):
self._appium_Service.stop()
status = self._appium_Service.is_running
return status
if __name__ == "__main__":
m = Mobile_adapter()
m.start_Server()
错误:
Traceback (most recent call last):
File "C:/Users/username/mobile_utils.py", line 27, in <module>
m.start_Server()
File "C:/Users/username/mobile_utils.py", line 15, in start_Server
self._appium_Service.start()
File "C:/Users/username\AppData\Local\Programs\Python\Python37\lib\site-packages\appium\webdriver\appium_service.py", line 155, in start
node = kwargs['node'] if 'node' in kwargs else self._get_node()
File "C:/Users/username\AppData\Local\Programs\Python\Python37\lib\site-packages\appium\webdriver\appium_service.py", line 76, in _get_node
raise AppiumServiceError('NodeJS main executable cannot be found. ' +
appium.webdriver.appium_service.AppiumServiceError: NodeJS main executable cannot be found. Make sure it is installed and present in PATH
环境变量路径: env variable