appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.22k stars 758 forks source link

(android )scrollTo not works well,it tap other elememt,and throws org.openqa.selenium.UnsupportedCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. #138

Closed liqing380 closed 8 years ago

liqing380 commented 9 years ago
java-client:2.1.0
real device: android 4.4.2
appium:1.3.4

my java code:

 public AndroidDriver appDriver;

 File classpathRoot = new File(System.getProperty("user.dir"));
        File appDir = new File(classpathRoot, "apps/Coremail4Android");
        File app = new File(appDir, "Coremail4Android.apk");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");          
        capabilities.setCapability("automationName","appium");                 //capabilities.setCapability("automationName","Selendroid");   
        capabilities.setCapability("deviceName",deviceinfo.serialNo);           //capabilities.setCapability("deviceName","Android Emulator");    //capabilities.setCapability("deviceName","Android");
        capabilities.setCapability("platformVersion", deviceinfo.releaseVer);  //capabilities.setCapability("platformVersion", ""4.4);
        capabilities.setCapability("platformName","Android");
        if(isNeedSetup)
            capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage", "cn.mailtech.app");
        capabilities.setCapability("appActivity", "cn.mailtech.app.activity.SplashMailtech");
        capabilities.setCapability("unicodeKeyboard","true"); 
        capabilities.setCapability("resetKeyboard","true"); 
        capabilities.setCapability("newCommandTimeout",newCommandTimeout); 
        appDriver = new AndroidDriver (new URL("http://" + deviceinfo.server + ":" + deviceinfo.port + "/wd/hub"), capabilities);

 se2.waitTime(se2.sec10);
 appDriver.scrollTo("More mail");

the text “More mail” is in a scrollable android.widget.ListView. with appium1.2.0+java-client1.7.0+AppiumDriver : AppiumDriver.scrollTo("More mail"); works well,it first swipe down to refresh the list and then drag back and forth until find the element.

but with appium1.3.4+java-client2.1.0+AndroidDriver : it not scrolled and tap another element which above the edge of the android.widget.ListView like this:it it tap the INBOX (or the edge of the blue color bar ) and not perform scrollTo "More mail": it tap the INBOX (or the edge of the blue color bar ) and then can not perform scrollTo i guess it tap beyong or on the upper border of the android.widget.ListView when perform scrollTo:

java error:

org.openqa.selenium.UnsupportedCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 14.04 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'jli', ip: '192.168.200.105', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Session ID: c0e94b03-9788-46d4-b664-2e55181f36d5
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{automationName=appium, platform=LINUX, javascriptEnabled=true, appActivity=cn.mailtech.app.activity.SplashMailtech, browserName=, networkConnectionEnabled=true, desired={newCommandTimeout=600, automationName=appium, platformVersion=4.4.2, platformName=Android, deviceName=NX507J, appActivity=cn.mailtech.app.activity.SplashMailtech, browserName=, unicodeKeyboard=true, resetKeyboard=true, appPackage=cn.mailtech.app}, locationContextEnabled=false, appPackage=cn.mailtech.app, newCommandTimeout=600, platformVersion=4.4.2, databaseEnabled=false, platformName=Android, deviceName=NX507J, webStorageEnabled=false, unicodeKeyboard=true, resetKeyboard=true, warnings={}, takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
    at io.appium.java_client.android.AndroidDriver.findElementByAndroidUIAutomator(AndroidDriver.java:244)
    at io.appium.java_client.android.AndroidDriver.scrollTo(AndroidDriver.java:53)
    at com.mailtech.coremailapp.cmappformailbox.DisplayMode.MoreMail.doTest(MoreMail.java:240)
    at com.mailtech.coremailapp.CmTestBaseEx.testMain(CmTestBaseEx.java:51)
    at com.mailtech.coremailapp.cmappformailbox.DisplayMode.MoreMail.testMoreMail(MoreMail.java:267)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

appium.log:

C:\Users\mailtech>appium -U NX507J -p 4727 -bp 4737
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 0.0.0.0:4727
info: [debug] Non-default server args: {"udid":"NX507J","port":4727,"bootstrapPo
rt":4737}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"newCommandTimeout":"600"
,"automationName":"appium","platformVersion":"4.4.2","platformName":"Android","d
eviceName":"NX507J","appActivity":"cn.mailtech.app.activity.SplashMailtech","bro
wserName":"","unicodeKeyboard":"true","resetKeyboard":"true","appPackage":"cn.ma
iltech.app"}}
info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
warn: Converting cap unicodeKeyboard from string to boolean. This might cause un
expected behavior.
warn: Converting cap resetKeyboard from string to boolean. This might cause unex
pected behavior.
info: [debug] Didn't get app but did get Android package, will attempt to launch
 it on the device
info: [debug] Creating new appium session c0e94b03-9788-46d4-b664-2e55181f36d5
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.7.0_21
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it's alr
eady on the device
info: [debug] Checking whether adb is present
info: [debug] Using adb from D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device NX507J
info: [debug] Setting device id to NX507J
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J wait-for-device
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "echo 'ready'"
info: [debug] Starting logcat capture
warn: No app capability, can't parse package/activity
info: [debug] Getting device API level
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Apk doesn't exist locally
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "rm -rf /data/local/tmp/strings.json"
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an ap
p path
info: [debug] Forwarding system:4737 to device:4724
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J forward tcp:4737 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J push "C:\\Users\\mailtech\\AppData\\Roaming\\npm\\node_m
odules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Enabling Unicode keyboard support
info: [debug] Pushing unicode ime to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J install "C:\Users\mailtech\AppData\Roaming\npm\node_modu
les\appium\build\unicode_ime_apk\UnicodeIME-debug.apk"
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "settings get secure default_input_method"
info: [debug] Unsetting IME 'io.appium.android.ime/.UnicodeIME'
info: [debug] Setting IME to 'io.appium.android.ime/.UnicodeIME'
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "ime enable io.appium.android.ime/.UnicodeIME"
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "ime set io.appium.android.ime/.UnicodeIME"
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J install "C:\Users\mailtech\AppData\Roaming\npm\node_modu
les\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J install "C:\Users\mailtech\AppData\Roaming\npm\node_modu
les\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools
\adb.exe -s NX507J shell uiautomator runtest AppiumBootstrap.jar -c io.appium.an
droid.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp
","status":0}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy"
,{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
info: [debug] Getting device API level
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "am start -S -a android.intent.action.MAIN -c andr
oid.intent.category.LAUNCHER -f 0x10200000 -n cn.mailtech.app/cn.mailtech.app.ac
tivity.SplashMailtech"
info: [debug] Waiting for pkg "cn.mailtech.app" and activity "cn.mailtech.app.ac
tivity.SplashMailtech" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "dumpsys window windows"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to 600 secs
info: [debug] Appium session started with sessionId c0e94b03-9788-46d4-b664-2e55
181f36d5
info: <-- POST /wd/hub/session 303 9183.605 ms - 9
info: --> GET /wd/hub/session/c0e94b03-9788-46d4-b664-2e55181f36d5 {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform"
:"LINUX","browserName":"","platformVersion":"4.4.2","webStorageEnabled":false,"t
akesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkCo
nnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"n
ewCommandTimeout":"600","automationName":"appium","platformVersion":"4.4.2","pla
tformName":"Android","deviceName":"NX507J","appActivity":"cn.mailtech.app.activi
ty.SplashMailtech","browserName":"","unicodeKeyboard":true,"resetKeyboard":true,
"appPackage":"cn.mailtech.app"},"newCommandTimeout":"600","automationName":"appi
um","platformName":"Android","deviceName":"NX507J","appActivity":"cn.mailtech.ap
p.activity.SplashMailtech","unicodeKeyboard":true,"resetKeyboard":true,"appPacka
ge":"cn.mailtech.app"},"sessionId":"c0e94b03-9788-46d4-b664-2e55181f36d5"}
info: <-- GET /wd/hub/session/c0e94b03-9788-46d4-b664-2e55181f36d5 200 4.177 ms
- 825 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion"
:"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":tr
ue,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabl
ed":false,"warnings":{},"desired":{"newCommandTimeout":"600","automationName":"a
ppium","platformVersion":"4.4.2","platformName":"Android","deviceName":"NX507J",
"appActivity":"cn.mailtech.app.activity.SplashMailtech","browserName":"","unicod
eKeyboard":true,"resetKeyboard":true,"appPackage":"cn.mailtech.app"},"newCommand
Timeout":"600","automationName":"appium","platformName":"Android","deviceName":"
NX507J","appActivity":"cn.mailtech.app.activity.SplashMailtech","unicodeKeyboard
":true,"resetKeyboard":true,"appPackage":"cn.mailtech.app"},"sessionId":"c0e94b0
3-9788-46d4-b664-2e55181f36d5"}
info: --> POST /wd/hub/session/c0e94b03-9788-46d4-b664-2e55181f36d5/element {"us
ing":"-android uiautomator","value":"new UiScrollable(new UiSelector().scrollabl
e(true).instance(0)).scrollIntoView(new UiSelector().descriptionContains(\"More
mail\").instance(0));new UiScrollable(new UiSelector().scrollable(true).instance
(0)).scrollIntoView(new UiSelector().textContains(\"More mail\").instance(0));"}

info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"-androi
d uiautomator","selector":"new UiScrollable(new UiSelector().scrollable(true).in
stance(0)).scrollIntoView(new UiSelector().descriptionContains(\"More mail\").in
stance(0));new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrol
lIntoView(new UiSelector().textContains(\"More mail\").instance(0));","context":
"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"find","params":{"strategy":"-android uiautomator","selector":"new UiScrollable
(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().
descriptionContains(\"More mail\").instance(0));new UiScrollable(new UiSelector(
).scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\"M
ore mail\").instance(0));","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding new UiScrollable(new UiSelector().scro
llable(true).instance(0)).scrollIntoView(new UiSelector().descriptionContains("M
ore mail").instance(0));new UiScrollable(new UiSelector().scrollable(true).insta
nce(0)).scrollIntoView(new UiSelector().textContains("More mail").instance(0));
using ANDROID_UIAUTOMATOR with the contextId:  multiple: false
info: [debug] [BOOTSTRAP] [debug] Parsing scrollable: new UiScrollable(new UiSel
ector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().descriptio
nContains("More mail").instance(0))
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: boolean arg: true
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: int arg: 0
info: [debug] [BOOTSTRAP] [debug] UiScrollable invoking method: public boolean c
om.android.uiautomator.core.UiScrollable.scrollIntoView(com.android.uiautomator.
core.UiObject) throws com.android.uiautomator.core.UiObjectNotFoundException arg
s: new UiSelector().descriptionContains("More mail").instance(0),
info: [debug] [BOOTSTRAP] [debug] UiScrollable coerce type: class com.android.ui
automator.core.UiObject arg: new UiSelector().descriptionContains("More mail").i
nstance(0)
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: class java.lang.String
 arg: "More mail"
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: int arg: 0
info: [debug] [BOOTSTRAP] [debug] Method name: scrollIntoView
info: [debug] [BOOTSTRAP] [debug] Setting uiObject for scrollIntoView
info: [debug] [BOOTSTRAP] [debug] Invoking method: public boolean com.android.ui
automator.core.UiScrollable.scrollIntoView(com.android.uiautomator.core.UiObject
) throws com.android.uiautomator.core.UiObjectNotFoundException with: com.androi
d.uiautomator.core.UiObject@416fccf8
info: [debug] [BOOTSTRAP] [error] com.android.uiautomator.core.UiObjectNotFoundE
xception: UiSelector[INSTANCE=0, SCROLLABLE=true]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Could not parse Ui
Selector argument: problem using reflection to call this method","status":9}
info: [debug] Condition unmet after 14025ms. Timing out.
info: [debug] Responding to client with error: {"status":9,"value":{"message":"T
he requested resource could not be found, or a request was received using an HTT
P method that is not supported by the mapped resource.","origValue":"Could not p
arse UiSelector argument: problem using reflection to call this method"},"sessio
nId":"c0e94b03-9788-46d4-b664-2e55181f36d5"}
info: <-- POST /wd/hub/session/c0e94b03-9788-46d4-b664-2e55181f36d5/element 500
14034.022 ms - 317
info: --> DELETE /wd/hub/session/c0e94b03-9788-46d4-b664-2e55181f36d5 {}
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "input keyevent 3"
info: [debug] Resetting IME to 'io.appium.android.ime/.UnicodeIME'
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "ime set io.appium.android.ime/.UnicodeIME"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down"
,"status":0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 28.222
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {"status":0,"value":null,"sessi
onId":"c0e94b03-9788-46d4-b664-2e55181f36d5"}
info: <-- DELETE /wd/hub/session/c0e94b03-9788-46d4-b664-2e55181f36d5 200 2436.6
64 ms - 76 {"status":0,"value":null,"sessionId":"c0e94b03-9788-46d4-b664-2e55181
f36d5"}
Jonahss commented 9 years ago

Hmm @bootstraponline what do you think? A problem with the UiSelector code?

bootstraponline commented 9 years ago

The best way to isolate these kinds of problems is to try a pure Java uiautomator approach to see if the problem exists. Then we can tell if it's an appium problem or a uiautomator one.

bootstraponline commented 9 years ago

Could not parse Ui Selector argument: problem using reflection to call this method seems like something wrong with the appium code or maybe the supplied Java string isn't valid.

liqing380 commented 9 years ago

@bootstraponline what does a pure Java uiautomator approach mean ?

liqing380 commented 9 years ago

@bootstraponline

then i try:

HashMap<String, String> scrollObject = new HashMap<String, String>();
RemoteWebElement element = (RemoteWebElement)appDriver.findElementByAndroidUIAutomator(
"new UiSelector().className(\"android.widget.ListView\")");
JavascriptExecutor js = (JavascriptExecutor) appDriver;
String webElementId = ((RemoteWebElement) element).getId();
scrollObject.put("text", "More mail");
scrollObject.put("element", webElementId);
js.executeScript("mobile: scrollTo", scrollObject);

_it works well ._

appium.log:

C:\Users\mailtech>appium -U NX507J -p 4727 -bp 4737 --no-reset
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 0.0.0.0:4727
info: [debug] Non-default server args: {"udid":"NX507J","port":4727,"bootstrapPo
rt":4737,"noReset":true}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"newCommandTimeout":"600"
,"platformVersion":"4.4","platformName":"Android","deviceName":"Android","appAct
ivity":"cn.mailtech.app.activity.SplashMailtech","browserName":"","appPackage":"
cn.mailtech.app"}}
info: Client User-Agent string: Apache-HttpClient/4.3.2 (java 1.5)
info: [debug] Didn't get app but did get Android package, will attempt to launch
 it on the device
info: [debug] Creating new appium session 56461b42-5e85-4c72-b1ef-3a6a95c466d2
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.7.0_21
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it's alr
eady on the device
info: [debug] Checking whether adb is present
info: [debug] Using adb from D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device NX507J
info: [debug] Setting device id to NX507J
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J wait-for-device
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "echo 'ready'"
info: [debug] Starting logcat capture
warn: No app capability, can't parse package/activity
info: [debug] Getting device API level
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Apk doesn't exist locally
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "rm -rf /data/local/tmp/strings.json"
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an ap
p path
info: [debug] Forwarding system:4737 to device:4724
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J forward tcp:4737 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J push "C:\\Users\\mailtech\\AppData\\Roaming\\npm\\node_m
odules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J install "C:\Users\mailtech\AppData\Roaming\npm\node_modu
les\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J install "C:\Users\mailtech\AppData\Roaming\npm\node_modu
les\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools
\adb.exe -s NX507J shell uiautomator runtest AppiumBootstrap.jar -c io.appium.an
droid.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp
","status":0}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy"
,{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
info: [debug] Getting device API level
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "am start -S -a android.intent.action.MAIN -c andr
oid.intent.category.LAUNCHER -f 0x10200000 -n cn.mailtech.app/cn.mailtech.app.ac
tivity.SplashMailtech"
info: [debug] Waiting for pkg "cn.mailtech.app" and activity "cn.mailtech.app.ac
tivity.SplashMailtech" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "dumpsys window windows"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to 600 secs
info: [debug] Appium session started with sessionId 56461b42-5e85-4c72-b1ef-3a6a
95c466d2
info: <-- POST /wd/hub/session 303 5528.897 ms - 9
info: --> GET /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2 {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform"
:"LINUX","browserName":"","platformVersion":"4.4","webStorageEnabled":false,"tak
esScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConn
ectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"new
CommandTimeout":"600","platformVersion":"4.4","platformName":"Android","deviceNa
me":"Android","appActivity":"cn.mailtech.app.activity.SplashMailtech","browserNa
me":"","appPackage":"cn.mailtech.app"},"newCommandTimeout":"600","platformName":
"Android","deviceName":"Android","appActivity":"cn.mailtech.app.activity.SplashM
ailtech","appPackage":"cn.mailtech.app"},"sessionId":"56461b42-5e85-4c72-b1ef-3a
6a95c466d2"}
info: <-- GET /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2 200 4.731 ms
- 683 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion"
:"4.4","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true
,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled
":false,"warnings":{},"desired":{"newCommandTimeout":"600","platformVersion":"4.
4","platformName":"Android","deviceName":"Android","appActivity":"cn.mailtech.ap
p.activity.SplashMailtech","browserName":"","appPackage":"cn.mailtech.app"},"new
CommandTimeout":"600","platformName":"Android","deviceName":"Android","appActivi
ty":"cn.mailtech.app.activity.SplashMailtech","appPackage":"cn.mailtech.app"},"s
essionId":"56461b42-5e85-4c72-b1ef-3a6a95c466d2"}
info: --> POST /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2/element {"us
ing":"-android uiautomator","value":"new UiSelector().className(\"android.widget
.ListView\")"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"-androi
d uiautomator","selector":"new UiSelector().className(\"android.widget.ListView\
")","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"find","params":{"strategy":"-android uiautomator","selector":"new UiSelector()
.className(\"android.widget.ListView\")","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding new UiSelector().className("android.wi
dget.ListView") using ANDROID_UIAUTOMATOR with the contextId:  multiple: false
info: [debug] [BOOTSTRAP] [debug] Parsing selector: new UiSelector().className("
android.widget.ListView")
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: java.lang.Class<T> arg
: "android.widget.ListView"
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: class java.lang.String
 arg: "android.widget.ListView"
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.ListVie
w]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"1"},"st
atus":0}
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":
"1"},"sessionId":"56461b42-5e85-4c72-b1ef-3a6a95c466d2"}
info: <-- POST /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2/element 200
98.968 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"56461b42-5e85-4c
72-b1ef-3a6a95c466d2"}
info: --> POST /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2/execute {"ar
gs":[{"element":"1","text":"More mail"}],"script":"mobile: scrollTo"}
warn: scrollTo will be removed in a future version of appium
info: [debug] Pushing command to appium work queue: ["element:scrollTo",{"text":
"More mail","direction":"vertical","elementId":"1"}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"element:scrollTo","params":{"text":"More mail","direction":"vertical","element
Id":"1"}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: scrollTo
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] Responding to client with success: {"status":0,"value":true,"sessi
onId":"56461b42-5e85-4c72-b1ef-3a6a95c466d2"}
info: <-- POST /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2/execute 200
6601.843 ms - 76 {"status":0,"value":true,"sessionId":"56461b42-5e85-4c72-b1ef-3
a6a95c466d2"}
info: --> DELETE /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2 {}
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: D:\adt-bundle-windows-x86_64-20140321\sdk\platform-
tools\adb.exe -s NX507J shell "input keyevent 3"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down"
,"status":0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 19.389
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {"status":0,"value":null,"sessi
onId":"56461b42-5e85-4c72-b1ef-3a6a95c466d2"}
info: <-- DELETE /wd/hub/session/56461b42-5e85-4c72-b1ef-3a6a95c466d2 200 932.76
7 ms - 76 {"status":0,"value":null,"sessionId":"56461b42-5e85-4c72-b1ef-3a6a95c4
66d2"}
Jonahss commented 9 years ago

Yeah but we want to deprecate those mobile: executescript commands.

bootstraponline commented 9 years ago

I guess we need to figure out the difference on Android between scrollTo and uiselector scrolling. Ideally we'd offer both (even if it's not part of mobile:) so that users can always find something that works.

fsuresh commented 9 years ago

HI , Any Solutions for this so far ?

Thanks Fredrick

moizjv commented 9 years ago

@fsuresh @liqing380 this should be fixed with 1.4.0-beta can you check?

fsuresh commented 9 years ago

Do you mean appium 1.4.0-beta ?

moizjv commented 9 years ago

yes

fsuresh commented 9 years ago

I installed Appium 1.4 now , but still the scrollTo is not working properly

moizjv commented 9 years ago

@fsuresh sorry for delayed response. Can you upgrade to latest appium version. We fixed scrollTo earlier

SrinivasanTarget commented 8 years ago

Closing this according to #385