-
-
Notifications
You must be signed in to change notification settings - Fork 159
Description
I want to open an app, slide left to the other page, but appium server error: http code (500)
This is my code:
`
require 'appium_lib'
class Appbase
include Appium::Device
include Appium::Android
include Appium::Common
def start
caps = { caps: { platformName: 'Android',
appActivity: '.ui.LauncherUI',
appPackage: 'com.tencent.mm',
deviceName:'02157df27164db19',
chromeOptions: { androidProcess: 'com.tencent.mm:tools'}},
newCommandTimeout:'180',
appium_lib: { sauce_username: nil, sauce_access_key: nil,wait_timeout: 30,wait_interval: 1 },
}
@app = Appium::Driver.new(caps)
@touch = Appium::TouchAction.new
@app.start_driver
end
def weChat
begin
@touch.swipe(start_x:1400,start_y:300,end_x:300,end_y:300,duration:1000).perform
@touch.swipe(start_x:1400,start_y:300,end_x:300,end_y:300,duration:1000).perform
end
end
end
apps=Appbase.new
apps.start
apps.weChat
`
This is part of the log:
`
info: [debug] Appium session started with sessionId b284bc83-8173-4235-8d27-a87f0bc7071a
info: <-- POST /wd/hub/session 303 8686.947 ms - 74
info: --> GET /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform":"ANY","browserName":"","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"browserName":"","version":"","platform":"ANY","javascriptEnabled":true,"cssSelectorsEnabled":true,"takesScreenshot":true,"nativeEvents":false,"rotatable":false,"platformName":"Android","appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"02157df27164db19","chromeOptions":{"androidProcess":"com.tencent.mm:tools"}},"version":"","cssSelectorsEnabled":true,"nativeEvents":false,"rotatable":false,"platformName":"Android","appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"02157df27164db19","chromeOptions":{"androidProcess":"com.tencent.mm:tools"}},"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: <-- GET /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a 200 0.690 ms - 912 {"status":0,"value":{"platform":"ANY","browserName":"","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"browserName":"","version":"","platform":"ANY","javascriptEnabled":true,"cssSelectorsEnabled":true,"takesScreenshot":true,"nativeEvents":false,"rotatable":false,"platformName":"Android","appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"02157df27164db19","chromeOptions":{"androidProcess":"com.tencent.mm:tools"}},"version":"","cssSelectorsEnabled":true,"nativeEvents":false,"rotatable":false,"platformName":"Android","appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"02157df27164db19","chromeOptions":{"androidProcess":"com.tencent.mm:tools"}},"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.16","revision":"ae6877eff263066b26328d457bd285c0cc62430d"}},"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: <-- GET /wd/hub/status 200 0.515 ms - 156 {"status":0,"value":{"build":{"version":"1.4.16","revision":"ae6877eff263066b26328d457bd285c0cc62430d"}},"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: --> POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/timeouts/implicit_wait {"ms":0}
info: [debug] Set Android implicit wait to 0ms
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: <-- POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/timeouts/implicit_wait 200 0.721 ms - 76 {"status":0,"value":null,"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: --> POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/touch/perform {"actions":[{"action":"press","options":{"x":1400,"y":300}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":300,"y":300}},{"action":"release"}]}
info: [debug] Pushing command to appium work queue: ["swipe",{"startX":1400,"startY":300,"endX":300,"endY":300,"steps":28}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"swipe","params":{"startX":1400,"startY":300,"endX":300,"endY":300,"steps":28}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: swipe
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][1440,2560]
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][1440,2560]
info: [debug] [BOOTSTRAP] [debug] Swiping from [x=1400.0, y=300.0] to [x=300.0, y=300.0] with steps: 28
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: <-- POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/touch/perform 200 591.272 ms - 76 {"status":0,"value":true,"sessionId":"b284bc83-8173-4235-8d27-a87f0bc7071a"}
info: --> POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/touch/perform {"actions":[{"action":"press","options":{"x":1400,"y":300}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":300,"y":300}},{"action":"release"},{"action":"press","options":{"x":1400,"y":300}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":300,"y":300}},{"action":"release"}]}
info: <-- POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/touch/perform 500 2.120 ms - 97
TypeError: Cannot read property 'element' of undefined
at C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-controller.js:937:20
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\underscore\underscore.js:227:11
at Function..each..forEach (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\underscore\underscore.js:153:9)
at Function..filter..select (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\underscore\underscore.js:226:7)
at [object Object]._.(anonymous function) [as filter] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\underscore\underscore.js:1496:34)
……
`
I think the wrong reason is the following request, the second request also bring the first time the parameters,resulting in server error(http code 500)
`
info: --> POST /wd/hub/session/b284bc83-8173-4235-8d27-a87f0bc7071a/touch/perform {"actions":[{"action":"press","options":{"x":1400,"y":300}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":300,"y":300}},{"action":"release"},{"action":"press","options":{"x":1400,"y":300}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":300,"y":300}},{"action":"release"}]}
`
Do i want to know the cause of the error? Thank you