@xiaomayi0323 已经重启了,还是不行 请问下你说的用 UIAutomation 跑一下是怎么玩的
@wozaihouma 我用的是模拟器,enable ui automation 已经打开,执行出现上面的问题
@jason 请问这段代码加到哪个位子啊 ,能不能把 bootstrap.js 的内容贴出来
@wirelessqa 哥,你能说下你的解决方法吗
@developer_luffy 还没有解决。。。
public void slide(WebElement origin_el, WebElement destination_el)
{
// appium converts longPress-moveto-release to a slide action
TouchAction touchAction = new TouchAction(this);
touchAction.longPress(origin_el).moveTo(destination_el).release().perform();
}
我使用上面的方法根据元素移动成功,但是根据坐标移动没有成功,方法如下
public void slide(int startX, int startY, int endX, int endY)
{
TouchAction touchAction = new TouchAction(this);
touchAction.longPress(startX, startY).moveTo(endX, endY).release().perform();
}
appium 报错日志如下:
info: --> POST /wd/hub/session/dfdfe492-8740-47c8-b799-c89e3fd652a2/touch/perfor
m {"actions":[{"action":"longPress","options":{"y":1365,"x":876}},{"action":"mov
eTo","options":{"y":609,"x":876}},{"action":"release","options":{}}]}
debug: Appium request initiated at /wd/hub/session/dfdfe492-8740-47c8-b799-c89e3
fd652a2/touch/perform
debug: Request received with params: {"actions":[{"action":"longPress","options"
:{"y":1365,"x":876}},{"action":"moveTo","options":{"y":609,"x":876}},{"action":"
release","options":{}}]}
debug: Pushing command to appium work queue: ["element:getLocation",{}]
error: Unhandled error: TypeError: Cannot read property 'x' of undefined
at null.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules
\appium\lib\devices\android\android-controller.js:886:27)
at next (C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node
_modules\async\lib\async.js:801:43)
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\appium\node_modul
es\async\lib\async.js:32:16
at exports.respond (C:\Users\Administrator\AppData\Roaming\npm\node_modules\
appium\lib\devices\common.js:28:9)
at null.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules
\appium\lib\devices\android\android.js:462:16)
at null.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules
\appium\lib\devices\android\uiautomator.js:93:9)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10) context: [POST /wd/hub/session
{"desiredCapabilities":{"platformVersion":"4.3","app":"D:\\autotest\\jsmcc_T_WA
P.apk","platformName":"Android","deviceName":"aidfm"}}]
debug: [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"eleme
nt:getLocation","params":{}}
debug: [BOOTSTRAP] [debug] Got command of type ACTION
debug: [BOOTSTRAP] [debug] Got command action: getLocation
debug: [BOOTSTRAP] [debug] Returning result: {"status":7}
有没有同学根据坐标拖动成功的,来帮忙瞧瞧啊
@tianwei024 我试了下不指定 appPackage 和 appActivity,还是一样的错误,appium 版本是 1.2.0
@kevinqinan WelcomeActivity 是一个欢迎页,要是换成别的话,页面不会成功加载,显示一半
把 selenium-java-2.41.0.jar 换成 2.42 版本的
支持,我先来试试,看看 github 项目操作
@seveniruby 执行后显示,模拟器上是启动成功的
C:\Users\Administrator>adb shell
root@android:/ # am start -S -a android.intent.action.MAIN -c android.intent.cat
egory.LAUNCHER -f 0x10200000 -n com.jsmcc/.ui.WelcomeActivity
AUNCHER -f 0x10200000 -n com.jsmcc/.ui.WelcomeActivity <
Stopping: com.jsmcc
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.L
AUNCHER] flg=0x10200000 cmp=com.jsmcc/.ui.WelcomeActivity }
楼主辛苦了
@lihuazhang 谢谢了 我来试下
@lihuazhang 请问下 如果不采用 webdriver 的话该怎样获取 window handler ?
找到你的 appium 安装目录,{appium_home}\lib\devices\android 下 adb.js
var supportedBuildToolDirs = [ '17.0.0'
, '18.0.1'
, '19.0.0'
, '19.0.1'
, 'android-4.2.2'
, 'android-4.3'
, 'android-4.4' ];
将 4.4 改成 4.4.2
上次遇到这个问题用这个方法解决的,你试试
好东西,写的很亮
已经试验成功,楼主写的很棒
新手宝典