appium在android7.0上无法启动问题
前言
由于最近很多android手机升级到7.0系统了,有些小伙伴的appium版本用的还是1.4版本,在运行android7.0的app自动化时候遇到无法启动问题:WebDriverException: Message: A new session could not be created
我的电脑环境:
- python 3.6
- android 7.0
- appium 1.4.13
android7.0遇到问题
1.执行代码:
# coding:utf-8
# 作者:上海-悠悠
from appium import webdriver
from time import sleep
desired_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.执行后报错如下:A new session could not be created
D:\soft\python3.6\python.exe D:/xcm_app_test/app/test_login.py
Traceback (most recent call last):
File "D:/xcm_app_test/app/test_login.py", line 11, 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 36, in __init__
super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, 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, capabilities)
File "D:\soft\python3.6\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in 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.common.exceptions.WebDriverException: Message: A new session could not be created. (Original error: Command failed: )
分析问题
1.遇到无法启动问题,报错都一样:A new session could not be created,看编辑器报错是没啥用的,这个时候就需要打开appium的日志界面,分析走到哪一步报错了,日志太多,就贴一部分了
> 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.从上面日志可以看出,当前的设备API版本是24,而appium1.4支持的最高API版本是23。打开appium客户端,左上角点机器人图标,点开platformVersion如下图所示
3.也就是说appium1.4支持最高android版本是6.0,查下资料可以知道android7.0需使用appium1.6.3以上版本才能支持。
解决问题
1.重新下载最新版appium,appium1.6以后版本都是以appium-desktop命名的,目前我使用的版本是appium-desktop1.2.2,安装完之后也就是V1.7.1版本
2.appium-desktop所以版本在github都能下载到:
appium-desktop 所有版本下载地址
3.appium-desktop和之前老的appium版本是可以共存的,所有不需要卸载之前的版本,重新打开appium1.7版本,运行代码
4.重新运行时候发现报这个错,从报错信息看是手机上安装的unlock版本不匹配(因为之前运行appium1.4版本有残留),解决办法:手动卸载手机上的appium settings和Unlock就可以了
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'
备注
1.有些小伙伴可能用的appium1.6版本,可以尝试加上这个参数,用uiautomator2运行
'automationName': 'uiautomator2'
# coding:utf-8
# 作者:上海-悠悠
from appium import webdriver
from time import sleep
desired_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+python QQ群交流:330467341**
appium在android7.0上无法启动问题的更多相关文章
- Appium适配Android7.0以上版本
Appium适配Android7.0以上版本 测试机型: 华为荣耀V9 安卓版本: Android7.0 appium版本: 1.65 说明: 公司新采购了一批安卓机器,拿了其中一台华为荣耀V9跑之前 ...
- [问题解决]Android7.0上PopupWindow的showAsDropDown位置问题
[问题解决]Android7.0上PopupWindow的showAsDropDown位置问题 /** * Created by diql on 2017/02/16. */ 问题说明 我的popup ...
- Appium在Android7.0及以上系统运行时报错的解决方案
背景:在使用Samsung S系列手机进行自动化测试时,发现同样脚本的情况下华为荣耀系列可以正常运行,最终发现差异在于Android7.0及以上系统和appium版本不匹配,需要升级appium.但需 ...
- appium+python自动化60-windows上同时启动多个appium服务,让多个android机器并行运行
前言 做android自动化的时候,启动一个appium服务,只能匹配一个手机去自动化执行.有时候想同一套代码,可以在不同的手机上执行,测下app在不同手机上兼容性. 这就需要启动多个appium服务 ...
- appium desktop v1.2.7在android7.0上运行报错“Error: Error executing adbExec”
1.参考下面链接,https://stackoverflow.com/questions/42283921/unable-to-run-appium-tests-on-android-7-0:得知需要 ...
- 【基础】火狐和谷歌在Selenium3.0上的启动(二)
参考地址:http://www.cnblogs.com/fnng/p/5932224.html https://github.com/mozilla/geckodriver [火狐浏览器] 火狐浏览器 ...
- 【转】Android7.0适配心得
本文出自:贾鹏辉的技术博客(http://www.devio.org) http://www.devio.org/2016/09/28/Android7.0%E9%80%82%E9%85%8D%E5% ...
- Android7.0新特性,及Android N适配
新特性部分 Android 7.0 Nougat 提供新功能以提升性能.生产效率和安全性,主要新增了下面的新特性和优化: 一.新的Notification Android N 添加了很多新的notif ...
- Android7.0 Doze模式分析(一)Doze介绍 & DeviceIdleController
參考:http://blog.csdn.net/gaugamela/article/details/52981984 在Android M中.Google就引入了Doze模式.它定义了一种全新的 ...
随机推荐
- CF910A
题解: 简单dp dp[i]=min(dp[i-j])+1; 代码: #include<bits/stdc++.h> using namespace std; ; int n,m,dp[N ...
- poj 1182 食物链(高级的带权并查集)
食物链 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 76486 Accepted: 22742 Description ...
- 微信小程序自定义tabbar的问题
个人感觉小程序的tab样式自定义的能力有所欠缺,不够美观,于是今天自己diy了一个tab 测试的时候发现,无论是使用navigator跳转(会出现点击的效果)还是用bindtap(触摸),因为没有定义 ...
- Kotlin Reference (七) Returns and Jumps
most from reference kotlin有三个结构跳跃表达式 return 默认情况下,从最近的封闭函数或匿名函数返回. break 跳出整个循环 continue 跳出本次循环,进行下一 ...
- NamedParameterJdbcTemplate常用方法总结
数据库结构 1.插入/修改/删除数据,使用update方法 插入数据1 API: int update(String sql, Map< String, ? > paramMap) 示例: ...
- awk命令结合管道命令对json文件进行统计分析
json文件内容: $ head file.json {"B": 0.337, "C": 0.663, "name": "xxx& ...
- 程序设计入门-C语言基础知识-翁恺-第五周:函数-详细笔记(五)
目录 第五周:函数 5.1 函数 5-2 使用函数 5.3 课后习题 第五周:函数 5.1 函数 什么是函数? 函数是一块代码,接受零个或多个参数,做一件事情,并返回零个或一个值. 函数声明语法 返回 ...
- [svn]显示日志很慢 点击文件查看更改记录也贼慢
特此记录,防止以后忘记. 解决办法: 在 C:\Windows\System32\drivers\etc (win7) 中加入 即可 亦或将代码的url中pc名字改为ip地址也可以解决问题 对文件夹点 ...
- debian 8.1 安装idempiere 2.1 X64 笔记
接上文.当虚拟服务器和虚拟机搭建完成后.登陆debian 8.1 X64. 进入虚拟服务器控制台.打开虚拟机.root登陆.(留好初始状态系统快照.以便系统恢复.) 由于之前debian8.1X64默 ...
- WampServer的配置
转自:http://www.cnblogs.com/azumia/archive/2012/06/06/2538872.html 第一,打开局域网访问 配置文件:点击右下角的WAMP 服务器小托盘,选 ...