Objective
Since many Android phones have recently been upgraded to the 7.0 system, some of the appium versions of the small partners are still in the 1.4 version, and have encountered an inability to boot when running android7.0 app Automation: webdriverexception:message:a New session could not being created
My Computer environment:
- Python 3.6
- Android 7.0
- Appium 1.4.13
android7.0 Encounter problems
1. Execute the code:
# coding:utf-8# 上海-悠悠from appium import webdriverfrom time import sleepdesired_caps = { 'platformName': 'Android', 'deviceName': 'A5RNW18316011440', 'platformVersion': '7.0', 'appPackage': 'com.baidu.yuedu', 'appActivity': 'com.baidu.yuedu.splash.SplashActivity' }driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
2. Error following execution:A new session could not being created
D:\soft\python3.6\python.exe D:/xcm_app_test/app/test_login.pytraceback (most recent): File "D:/xcm_app_ test/app/test_login.py ", line one, in <module> driver = Webdriver. Remote (' Http://127.0.0.1:4723/wd/hub ', desired_caps) File "D:\soft\python3.6\lib\site-packages\appium\webdriver\ webdriver.py ", line-in-__init__ super (Webdriver, self). __init__ (Command_executor, Desired_capabilities, BROWSER_PR Ofile, Proxy, keep_alive) File "D:\soft\python3.6\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90 , in __init__ self.start_session (desired_capabilities, Browser_profile) File "D:\soft\python3.6\lib\site-packages\ selenium\webdriver\remote\webdriver.py ", line 177, in start_session response = Self.execute (Command.new_session, capab ilities) File "D:\soft\python3.6\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, and execute self . Error_handler.check_response (response) File "D:\soft\python3.6\lib\site-packages\selenium\webdriver\remote\errorhandler.py ", line 192, in Check_response raise Exception_class (message, screen, StackTrace) Selenium.comm On.exceptions.webdriverexception:message:a new session could not be created. (Original Error:command failed:)
Analyze problems
1. Encountered the failure to start the problem, the error is the same: A new session could not be created, see the editor error is no use, this time you need to open the Appium log interface, analysis go to which step error, log too much, just paste part of the
> info: [debug] Device is at API Level 24> info: Device API level is: 24> info: [debug] Extracting strings for language: default> info: [debug] Apk doesn't exist locally> info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
2. As can be seen from the above log, the current device API version is 24, and the highest API version supported by appium1.4 is 23. Open the Appium client, point to the upper left corner of the robot icon, click on Platformversion as shown
3. That is to say appium1.4 supports the highest Android version is 6.0, check the information can be android7.0 need to use more than appium1.6.3 version to support.
Solve the problem
1. Re-download the latest version appium,appium1.6 later versions are named after Appium-desktop, I currently use the version is appium-desktop1.2.2, after installation is V1.7.1 version
2.appium-desktop so the version can be downloaded to GitHub:
Appium-desktop all Versions
3.appium-desktop and previous old Appium versions can coexist, all without the need to uninstall the previous version, reopen the appium1.7 version, run the code
4. Re-run time to find this error, from the error message is installed on the phone unlock version mismatch (because the previous run appium1.4 version of the residue), Workaround: Manually uninstall the phone on the Appium settings and unlock on it.
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'D\:\\soft\\Android\\platform-tools\\adb.exe -P 5037 -s A5RNW18316011440 install C\:\\Users\\admin\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk' exited with code 1'; Stderr: 'Failed to install C:\Users\admin\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-unlock\bin\unlock_apk-debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package io.appium.unlock signatures do not match the previously installed version; ignoring!]'; Code: '1'
Note
1. Some small partners may use the appium1.6 version, can try to add this parameter, run with Uiautomator2
' Automationname ': ' Uiautomator2 '
# coding:utf-8# 上海-悠悠from appium import webdriverfrom time import sleepdesired_caps = { 'platformName': 'Android', 'deviceName': 'A5RNW18316011440', 'platformVersion': '7.0', 'automationName': 'uiautomator2', 'appPackage': 'com.baidu.yuedu', 'appActivity': 'com.baidu.yuedu.splash.SplashActivity' }driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
Appium cannot start the problem on android7.0