【Appium踩坑】io.appium.uiautomator2.common.exceptions.InvalidArgumentException: ‘capabilities‘ are mand
2022-06-24 09:59:54
本地安装 Appium desktop v 1.13版本(06 May 2019)
启动server后就会报错:
[W3C] Encountered internal error running command: A new session could not be created. Details: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: 'capabilities' are mandatory for session creation
Appium issue里有一个针对这个问题的讨论
开发者建议升级到当时最新的beta版 ->
1.14.0-beta.1 (05 Jul 2019)
刚好和我们本地的情况一致,问题基本出在v1.13及之前版本。
升级 appium 版本。
1.14.0-beta.1 (05 Jul 2019) 也太旧了,
直接升级到最新的appium版本即可。
Appium release
[W3C] Encountered internal error running command: A new session could not be created. Details: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: 'capabilities' are mandatory for session creation
[W3C] io.appium.uiautomator2.common.exceptions.SessionNotCreatedException: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: 'capabilities' are mandatory for session creation
[W3C] at io.appium.uiautomator2.handler.NewSession.safeHandle(NewSession.java:59)
[W3C] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)
[W3C] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)
[W3C] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)
[W3C] at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[W3C] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[W3C] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
[W3C] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
[W3C] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
[W3C] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[W3C] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[W3C] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
[W3C] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
[W3C] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
[W3C] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
[W3C] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
[W3C] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
[W3C] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
[W3C] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
[W3C] at java.lang.Thread.run(Thread.java:923)
[W3C] Caused by: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: 'capabilities' are mandatory for session creation
[W3C] at io.appium.uiautomator2.handler.NewSession.safeHandle(NewSession.java:47)
[W3C] ... 30 more
[W3C]
[HTTP] <-- POST /wd/hub/session 500 6459 ms - 3708
brew install node # 获取 node.js
npm install -g appium # 获取 appium
npm install wd # 获取appium客户端
然后你需要启动 appium,例如:
appium & # 启动 appium
要编译和运行所有测试,请运行:
gradlew
gradlew clean assemble
gradle test
要运行单个测试,请运行:
gradle -Dtest=ccom.lyve.android.AndroidBasicTest test
APP数据获取,目前为止已介绍了两种方法,一种是APK反编译,一种是破解数据流在传输过程中的各种转换;上述两种方式,对能力和毅力都有很大的要求。本文“投机取巧”,仅关注输入输出;输入的是用户APP数据所在页面的操作,输出的是数据所在的接口源码。输出,可通过Fiddler、Charles等拦截工具进行拦截,本文不作累述;输入,涉及Appium自动化测试,本文将对此进行详解。
io.appium.gappium.sampleapp
由Backbone.js和TopCoat构建的示例Mobile / PhoneGap应用程序由封装在Cordova项目中提供。
请参阅了解更多详细信息。
Appium报错NoSuchDriverException解决方法
io.appium.uiautomator2.common.exceptions.UiAutomator2Exception: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: A session is either terminated or not started
重启PC端和手机,就没问题了
下面基本是Robot Framework集成Selenium Library开发包,进行Mobile Web场景下发生的问题,但单独使用PC Selenium也很可能会有同样问题,大家可酌情参考使用。
1. 元素不可见时,不能取到text value
问题:${home_amount} Get Text //*[@id="row_1"]/div[2] #提示不可见,不能获取这个值
解决:通过滚动条拖动,直到该元素可见后,再使用Get Text关键字取值。
备注:元素不可见情况...
1.由于需要用到appium获取toast信息,所以必须设置desirve[“automationName”] = “UiAutomator2”,但是设置之后,就遇到上图中提示的问题,在进行apk注册的时候失败了,那接下来当然就是去找各种方法解决,去看了github上面的issue,按照上面说的各种方法都尝试了,然尔并没有...
Appium执行用例重复安装 io.appium.uiautomator.server 和 io.appium.uiautomator.server.test
环境 : mac
修改文件1:
/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/driver.js
修改内容注释...
一.APPIUM报错:occurred while processing the command. Original error: The desired capabilities must include either an app, appPackage or browserName解决办法:1.caps加上'automationName':'UiAutomator1';2.该问题出现的原因是:安装了不同的uiautomator版本,卸载原来的就行。但是手动卸载Appium Settings后还是会出现