Appium启动app抛异常A new session could not be created.

一、现象:

1.执行appium自动化测试脚本时,安装成功,启动成功
2.同时出现报错信息

FAILED CONFIGURATION: @BeforeClass setUp
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: com.bond.mobile.bondapp/.activity.GuideActivity never started. Current: com.bond.mobile.bondapp/.activity.GuideActivity,) (WARNING: The server did not provide any stacktrace information)
  • 1
  • 2

二、原因:

AppiumForWindows_1_4_16_1Android 6.0不兼容,对比的时候多了个逗号

Appium启动app抛异常A new session could not be created._第1张图片

三、解决办法:

1.找到上图中提示的位置中打开adb.js文件

C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\

加入一行代码

foundActivity = foundActivity.replace(/,/g, '');

将逗号替换为空,如图

Appium启动app抛异常A new session could not be created._第2张图片

2.重新启动appium,执行自动化测试脚本,app正常启动且无报错,完美解决~~

--------------------- 本文来自 hualf 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/hualf/article/details/78601239?utm_source=copy

你可能感兴趣的:(Appium启动app抛异常A new session could not be created.)