python代码:
from appium import webdriver
#手机配置信息
info = {'platformName': 'Android',
#版本
'platformVersion': '14.0.550',
#设备名
'deviceName': 'ea601edc',
#软件包名
'appPackage': 'com.zui.camera',
#界面名
'appActivity': 'com.zui.camera.CameraLauncher',
#用户名、密码重置
'noRest': 'False',
}
#Remote()手机配置信息、服务器地址
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',info)
driver.quit()
运行
Traceback (most recent call last):
File "C:\Users\LENOVO\PycharmProjects\zidonghuaceshi\xiangji.py", line 17, in
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',info)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python310\lib\site-packages\appium\webdriver\webdriver.py", line 230, in init
super().init(
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 270, in init
self.start_session(capabilities, browser_profile)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python310\lib\site-packages\appium\webdriver\webdriver.py", line 320, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 428, in execute
self.error_handler.check_response(response)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details
at getResponseForW3CError (C:\Users\LENOVO\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
at asyncHandler (C:\Users\LENOVO\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)
APPIUM:
(C:\Users\LENOVO\AppData\Local\Programs\Appium\resources\app\node_modules\appium\lib\appium.js:371:35)
[HTTP] <-- POST /wd/hub/session 500 773 ms - 933