在刚进入appium的世界时,遇到无数的坑,趟过无数的浑水,现在整理一些常用的报错讯息,供大家参考

1.org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

错误可能原因:
  1).appium服务未启动
  2).appium服务地址写错

解决方法:
  1).启动appium服务端
  2).查看代码中服务端地址是否正确,若未修改,默认的地址为:http://127.0.0.1:4723/wd/hub

2. org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)

错误可能原因:
  1).DesiredCapabilities 对象参数中缺少deviceName参数
  2).参数deviceName 写错了,比如写成了  devicesName、devicename

解决方法:
  查看代码中deviceName参数是否缺少或者是否写错,修正,重新运行

3. org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Bad app: C:\Users\Nick\Desktop\weixin.apk. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat 'C:\Users\Nick\Desktop\weixin.apk')

错误可能原因:
  1).apk路径写错了,导致程序未找到该apk
  2).设置访问的是远程appium服务端,而apk路径却写成了本地地址

解决方法:
  1).仔细检查apk路径
  2).如果是远程appium服务端,app地址及app要写appium服务端上apk所在的路径

4. org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: No app set; either start appium with --app or pass in an 'app' value in desired capabilities, or set androidPackage to launch pre-existing app on device)

错误可能原因:
  参数中即没有app参数,也没有appPackage参数

解决方法:
  1).设置app参数,进行安装app然后测试
  2).设置appPackage及appActivity参数,启动已安装的应用进行测试

5. org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity)

错误可能原因:
  1).appActivity参数写错或者appPackage写错
  2).设备上没安装这个app

解决方法:
  1).检查appActivity参数值
  2).检查设备是否安装了app

6. org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find a connected Android device.)

错误可能原因:
  当前没有设备在线,可进入cmd,输入adb devices查看是否有设备在线

解决方法:
  插上设备或者检查设备连接是否有问题(可重启adb、重插设备、杀掉各种手机助手进程),若使用模拟器,可重启模拟器查看

7.org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress)

错误可能原因:
  上次执行脚本没有正常关闭session

解决方法:
  1).重启服务端后再执行脚本
  2).等待session自动断开后再执行脚本
  3).利用try catch finally块执行driver.quit()

  4).勾选服务端的Override Existing Session参数,再下次执行脚本时会自动覆盖前面的session

最新文章

  1. jQuery Raty 星级评分
  2. 第五章 搭建S3C6410开发板的测试环境
  3. PHP+Mysql+jQuery实现地图区域数据统计-展示数据
  4. Netty学习四:Channel
  5. uC/OS-II实现TEST.MAK块
  6. C语言 malloc、calloc、realloc的区别
  7. java基础-java核心知识库
  8. IDEA -14 注册码生成工具
  9. Java获取某月天数
  10. 使用selector修改TextView中字体的颜色
  11. C#- 控制台Timer
  12. 第一个MVC模型
  13. 数据库常用操作SQL语句
  14. numpy/pandas时间互相转换
  15. BaseDao封装
  16. Bootstrap 完全教程笔记
  17. 安装Git Bash图文教程
  18. 警惕32位程序在MethodImplOptions.Synchronized在x64机器上的同步缺陷[z]
  19. 51 nod 1181 质数中的质数(质数筛法)
  20. 串口-CreateFile的使用

热门文章

  1. mxnet框架样本,使用C++接口
  2. .net整理
  3. web前端性能优化总结
  4. HDU 1014 Uniform Generator【GCD,水】
  5. [bzoj3702] 二叉树
  6. FtpUtil.java测试 (淘淘商城第三课文件上传)
  7. 狗书无敌,天下第一(flask基础)
  8. tomcat实现热部署的配置
  9. NopCommerce用core重写ef
  10. Lucene学习笔记1(V7.1)