appium / java-client

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

Unable to find Element in if Condition. #1217

Open Upma-10 opened 5 years ago

Upma-10 commented 5 years ago

Description

I am trying to find an Element in if condition. It is showing error as incorrect JSON status mapping for 'unknown error' (500 expected) Exception in thread "main" org.openqa.selenium.WebDriverException: Method is not implemented. Please help

Environment

Details

Please provide more details, if necessary.

Code To Reproduce Issue [ Good To Have ]

    DesiredCapabilities cap=new DesiredCapabilities();
    cap.setCapability("automationName","UiAutomator2");
    cap.setCapability("deviceName","Samsung J7Nxt");
    cap.setCapability("platformName","Android");
    cap.setCapability("platformVersion","8.1.0");
    cap.setCapability("adbExecTimeout", "200000");
    //cap.setCapability("app","/Users⁩/⁨upmabhatnagar⁩/⁨Desktop/Celcom-SelfHeal_v4.2.apk");
    cap.setCapability("autoGrantPermissions",true);
    cap.setCapability("appPackage","com.xxxxxxxxxx.xxxxxxxx");
    cap.setCapability("appActivity","com.xxxxxxxxxxxx.xxxxxxxxxx.MainActivity");

    URL url = new URL("http://0.0.0.0:4723/wd/hub");
    AndroidDriver<WebElement> driver = new AndroidDriver<WebElement>(url, cap);
    Thread.sleep(10000);

   /* if(driver.findElementByXPath("//android.widget.CheckBox[@bounds='[82,791][688,855]']").isDisplayed())
    {
        driver.findElementByXPath("//android.widget.TextView[@bounds='[477,871][672,943]']").click();
        System.out.println("Allow clicked");
    }*/

    WebElement num =driver.findElementByXPath ("//android.widget.EditText[@bounds='[174,590][626,658]']");
    num.sendKeys("+447448132541");
    Thread.sleep(2000);

    WebElement login=driver.findElementByXPath("//android.widget.Button[@bounds='[94,698][626,770]']");
    login.click();
    Thread.sleep(10000);

    if(driver.findElementByXPath("//android.app.Dialog[@bounds='[20,514][700,814]']").isDisplayed())
    {
        driver.findElementByXPath("//android.widget.Button[@index='0']").click();
    }

}

Ecxeption stacktraces

Aug 27, 2019 4:07:58 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 INFO: Detected dialect: W3C Aug 27, 2019 4:08:23 PM org.openqa.selenium.remote.ErrorCodes toStatus INFO: HTTP Status: '405' -> incorrect JSON status mapping for 'unknown error' (500 expected) Exception in thread "main" org.openqa.selenium.WebDriverException: Method is not implemented Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'testing-mac.local', ip: 'fe80:0:0:0:bd:e9af:ae7:5ab2%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_171' Driver info: io.appium.java_client.android.AndroidDriver Capabilities {adbExecTimeout: 200000, appActivity: com.lycamobile.selfcare.Mai..., appPackage: com.lycamobile.selfcare, autoGrantPermissions: true, automationName: UiAutomator2, databaseEnabled: false, desired: {adbExecTimeout: 200000, appActivity: com.lycamobile.selfcare.Mai..., appPackage: com.lycamobile.selfcare, autoGrantPermissions: true, automationName: UiAutomator2, deviceName: Samsung J7Nxt, platformName: android, platformVersion: 8.1.0}, deviceApiLevel: 27, deviceManufacturer: samsung, deviceModel: SM-J701F, deviceName: 5200050afec97485, deviceScreenDensity: 320, deviceScreenSize: 720x1280, deviceUDID: 5200050afec97485, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2, platform: LINUX, platformName: Android, platformVersion: 8.1.0, statBarHeight: 48, takesScreenshot: true, viewportRect: {height: 1232, left: 0, top: 48, width: 720}, warnings: {}, webStorageEnabled: false} Session ID: e4532345-1c97-44e7-b760-9192d9f3a430 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) at io.appium.java_client.DefaultGenericMobileElement.execute(DefaultGenericMobileElement.java:45) at io.appium.java_client.MobileElement.execute(MobileElement.java:1) at io.appium.java_client.android.AndroidElement.execute(AndroidElement.java:1) at org.openqa.selenium.remote.RemoteWebElement.isDisplayed(RemoteWebElement.java:326) at demo.lyca_app.main(lyca_app.java:47)

Link to Appium logs

[Appium] Welcome to Appium v1.13.0 [Appium] Non-default server args: [Appium] sessionOverride: true [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session [HTTP] {"desiredCapabilities":{"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","adbExecTimeout":"200000","platformVersion":"8.1.0","automationName":"UiAutomator2","autoGrantPermissions":true,"platformName":"Android","deviceName":"Samsung J7Nxt"},"capabilities":{"firstMatch":[{"adbExecTimeout":"200000","appium:appActivity":"com.lycamobile.selfcare.MainActivity","appium:appPackage":"com.lycamobile.selfcare","appium:autoGrantPermissions":true,"appium:automationName":"UiAutomator2","appium:deviceName":"Samsung J7Nxt","platformName":"android","appium:platformVersion":"8.1.0"}]}} [W3C] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","adbExecTimeout":"200000","platformVersion":"8.1.0","automationName":"UiAutomator2","autoGrantPermissions":true,"platformName":"Android","deviceName":"Samsung J7Nxt"},null,{"firstMatch":[{"adbExecTimeout":"200000","appium:appActivity":"com.lycamobile.selfcare.MainActivity","appium:appPackage":"com.lycamobile.selfcare","appium:autoGrantPermissions":true,"appium:automationName":"UiAutomator2","appium:deviceName":"Samsung J7Nxt","platformName":"android","appium:platformVersion":"8.1.0"}]}] [BaseDriver] Event 'newSessionRequested' logged at 1566902265700 (16:07:45 GMT+0530 (IST)) [BaseDriver] The capabilities ["adbExecTimeout"] are not standard capabilities and should have an extension prefix [Appium] Appium v1.13.0 creating new AndroidUiautomator2Driver (v1.33.1) session [Appium] Capabilities: [Appium] adbExecTimeout: 200000 [Appium] platformName: android [Appium] appActivity: com.lycamobile.selfcare.MainActivity [Appium] appPackage: com.lycamobile.selfcare [Appium] autoGrantPermissions: true [Appium] automationName: UiAutomator2 [Appium] deviceName: Samsung J7Nxt [Appium] platformVersion: 8.1.0 [BaseDriver] W3C capabilities {"alwaysMatch":{"appium:adb... and MJSONWP desired capabilities {"appActivity":"com.lycamob... were provided [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"appium:adb... [BaseDriver] Number capability passed in as string. Functionality may be compromised. [BaseDriver] Capability 'adbExecTimeout' changed from string ('200000') to integer (200000). This may cause unexpected behavior [BaseDriver] Session created with session id: e4532345-1c97-44e7-b760-9192d9f3a430 [ADB] Found 1 'build-tools' folders under '/Users/upmabhatnagar/Library/Android/sdk' (newest first): [ADB] /Users/upmabhatnagar/Library/Android/sdk/build-tools/29.0.1 [ADB] Using 'adb' from '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb' [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] 1 device(s) connected [AndroidDriver] Looking for a device with Android '8.1.0' [ADB] Setting device id to 5200050afec97485 [ADB] Getting device platform version [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 8.1.0 [AndroidDriver] Using device: 5200050afec97485 [ADB] Using 'adb' from '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb' [ADB] Setting device id to 5200050afec97485 [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 27 [ADB] Device API level: 27 [AndroidDriver] No app sent in, not parsing package/activity [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 wait-for-device' [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package io.appium.settings' [ADB] 'io.appium.settings' is installed [ADB] Getting package info for 'io.appium.settings' [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package io.appium.settings' [ADB] Using 'aapt' from '/Users/upmabhatnagar/Library/Android/sdk/build-tools/29.0.1/aapt' [ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.0' >= '2.14.0') [ADB] There is no need to install/upgrade '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/apks/settings_apk-debug.apk' [ADB] Getting IDs of all 'io.appium.settings' processes [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell 'pgrep --help; echo $?'' [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell pgrep -f io\.appium\.settings' [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions. [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell appops set io.appium.settings android\:mock_location allow' [Logcat] Starting logcat capture [ADB] Getting install status for io.appium.uiautomator2.server [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package io.appium.uiautomator2.server' [ADB] 'io.appium.uiautomator2.server' is installed [ADB] Getting package info for 'io.appium.uiautomator2.server' [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package io.appium.uiautomator2.server' [ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('3.5.1' >= '3.5.1') [UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled [ADB] Checking app cert for /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk [ADB] Using 'apksigner' from '/Users/upmabhatnagar/Library/Android/sdk/build-tools/29.0.1/apksigner' [ADB] Starting '/Users/upmabhatnagar/Library/Android/sdk/build-tools/29.0.1/apksigner' with args '["verify","--print-certs","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk"]' [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81 [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87 [ADB] [ADB] '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk' is already signed. [ADB] Getting install status for io.appium.uiautomator2.server.test [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package io.appium.uiautomator2.server.test' [ADB] 'io.appium.uiautomator2.server.test' is installed [ADB] Checking app cert for /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk [ADB] Starting '/Users/upmabhatnagar/Library/Android/sdk/build-tools/29.0.1/apksigner' with args '["verify","--print-certs","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk"]' [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81 [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87 [ADB] [ADB] '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' is already signed. [UiAutomator2] Server packages are not going to be (re)installed [UiAutomator2] Waiting up to 30000ms for services to be available [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell pm list instrumentation' [UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8201 [ADB] Forwarding system: 8201 to device: 6790 [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 forward tcp\:8201 tcp\:6790' [UiAutomator2] No app capability. Assuming it is already on the device [ADB] Getting install status for com.lycamobile.selfcare [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package com.lycamobile.selfcare' [ADB] 'com.lycamobile.selfcare' is installed [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell am force-stop com.lycamobile.selfcare' [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell pm clear com.lycamobile.selfcare' [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys package com.lycamobile.selfcare' [ADB] Retrieving requested permissions [ADB] Retrieved 14 permission(s) from ["requested"] group(s) [ADB] Retrieving granted permissions [ADB] Retrieved 43 permission(s) from ["install","runtime"] group(s) [ADB] com.lycamobile.selfcare contains no permissions available for granting [AndroidDriver] Performed fast reset on the installed 'com.lycamobile.selfcare' application (stop and clear) [UiAutomator2] Performing shallow cleanup of automation leftovers [UiAutomator2] The following obsolete sessions are still running: ["20f471ec-01a6-4006-aa0d-33f9c8e26351"] [UiAutomator2] Cleaning up the obsolete sessions [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell am force-stop io.appium.uiautomator2.server.test' [UiAutomator2] Starting UIAutomator2 server 3.5.1 [UiAutomator2] Using UIAutomator2 server from '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk' and test from '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' [UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online... [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","5200050afec97485","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"] [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8201/wd/hub/status] with no body [WD Proxy] Got an unexpected response: {"code":"ECONNRESET"} [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8201/wd/hub/status] with no body [WD Proxy] Got an unexpected response: {"code":"ECONNRESET"} [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server: [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8201/wd/hub/status] with no body [WD Proxy] Got an unexpected response: {"code":"ECONNRESET"} [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8201/wd/hub/status] with no body [WD Proxy] Got response with status 200: "{\"sessionId\":\"None\",\"status\":0,\"value\":\"Status Invoked\"}" [WD Proxy] Determined that the downstream protocol for proxy is MJSONWP [UiAutomator2] The initialization of the instrumentation process took 4196ms [WD Proxy] Matched '/session' to command name 'createSession' [WD Proxy] Proxying [POST /session] to [POST http://localhost:8201/wd/hub/session] with body: {"desiredCapabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"Samsung J7Nxt","platformVersion":"8.1.0"},"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"5200050afec97485","platformVersion":"8.1.0","deviceUDID":"5200050afec97485"}} [WD Proxy] Got response with status 200: {"sessionId":"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c","status":0,"value":"Created Session"} [WD Proxy] Proxying [GET /appium/device/info] to [GET http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/appium/device/info] with no body [WD Proxy] Got response with status 200: "{\"sessionId\":\"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c\",\"status\":0,\"value\":{\"androidId\":\"fdd5f76ecf5a0334\",\"manufacturer\":\"samsung\",\"model\":\"SM-J701F\",\"brand\":\"samsung\",\"apiVersion\":\"27\",\"platformVersion\":\"8.1.0\",\"carrierName\":\"\",\"realDisplaySize\":\"720x1280\",\"displayDensity\":320,\"networks\":[{\"type\":13,\"typeName\":\"WIFI_P2P\",\"subtype\":0,\"subtypeName\":\"\",\"isConnected\":false,\"detailedState\":\"IDLE\",\"state\":\"UNKNOWN\",\"extraInfo\":null,\"isAvailable\":true,\"isFailover\":false,\"isRoaming\":false,\"capabilities\":{\"transportTypes\":\"NET_CAPABILITY_SUPL\",\"networkCapabilities\":\"\",\"linkUpstreamBandwidthKbps\":1048576,\"linkDownBandwidthKbps\":1048576,\"signalStrength\":-2147483648,\"networkSpecifier\":null,\"SSID\":null}},{\"type\":1,\"typeName\":\"WIFI\",\"subtype\":0,\"subtypeName\":\"\",\"isConnected\":true,\"detailedState\":\"CONNECTED\",\"state\":\"CONNECTED\",\"extraInfo\":\"\\"iotnetplus\\"\",\"isAvailable\":true,\"isFailover\":false,\"... [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell dumpsys window' [AndroidDriver] Screen already unlocked, doing nothing [UiAutomator2] UiAutomator2 did not start the activity we were waiting for, 'com.lycamobile.selfcare/com.lycamobile.selfcare.MainActivity'. Starting it ourselves [ADB] Running '/Users/upmabhatnagar/Library/Android/sdk/platform-tools/adb -P 5037 -s 5200050afec97485 shell am start -W -n com.lycamobile.selfcare/com.lycamobile.selfcare.MainActivity -S' [WD Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/appium/device/pixel_ratio] with body: {} [WD Proxy] Got response with status 200: "{\"sessionId\":\"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c\",\"status\":0,\"value\":2}" [WD Proxy] Matched '/appium/device/system_bars' to command name 'getSystemBars' [WD Proxy] Proxying [GET /appium/device/system_bars] to [GET http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/appium/device/system_bars] with body: {} [WD Proxy] Got response with status 200: "{\"sessionId\":\"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c\",\"status\":0,\"value\":{\"statusBar\":48}}" [WD Proxy] Matched '/window/current/size' to command name 'getWindowSize' [WD Proxy] Proxying [GET /window/current/size] to [GET http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/window/current/size] with body: {} [WD Proxy] Got response with status 200: "{\"sessionId\":\"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c\",\"status\":0,\"value\":{\"height\":1280,\"width\":720}}" [Appium] New AndroidUiautomator2Driver session created successfully, session e4532345-1c97-44e7-b760-9192d9f3a430 added to master session list [BaseDriver] Event 'newSessionStarted' logged at 1566902278938 (16:07:58 GMT+0530 (IST)) [W3C (e4532345)] Cached the protocol value 'W3C' for the new session e4532345-1c97-44e7-b760-9192d9f3a430 [W3C (e4532345)] Responding to client with driver.createSession() result: {"capabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"Samsung J7Nxt","platformVersion":"8.1.0"},"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"5200050afec97485","platformVersion":"8.1.0","deviceUDID":"5200050afec97485","deviceApiLevel":27,"deviceScreenSize":"720x1280","deviceScreenDensity":320,"deviceModel":"SM-J701F","deviceManufacturer":"samsung","pixelRatio":2,"statBarHeight":48,"viewportRect":{"left":0,"top":48,"width":720,"height":1232}}} [HTTP] <-- POST /wd/hub/session 200 13243 ms - 1059 [HTTP] [HTTP] --> GET /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430 [HTTP] {} [W3C (e4532345)] Calling AppiumDriver.getSession() with args: ["e4532345-1c97-44e7-b760-9192d9f3a430"] [UiAutomator2] Getting session details from server to mix in [WD Proxy] Matched '/' to command name 'getSession' [WD Proxy] Proxying [GET /] to [GET http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c] with body: {} [WD Proxy] Got response with status 200: "{\"sessionId\":\"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c\",\"status\":0,\"value\":{}}" [W3C (e4532345)] Responding to client with driver.getSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"Samsung J7Nxt","platformVersion":"8.1.0"},"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"5200050afec97485","platformVersion":"8.1.0","deviceUDID":"5200050afec97485","deviceApiLevel":27,"deviceScreenSize":"720x1280","deviceScreenDensity":320,"deviceModel":"SM-J701F","deviceManufacturer":"samsung","pixelRatio":2,"statBarHeight":48,"viewportRect":{"left":0,"top":48,"width":720,"height":1232}} [HTTP] <-- GET /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430 200 49 ms - 991 [HTTP] [HTTP] --> GET /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430 [HTTP] {} [W3C (e4532345)] Calling AppiumDriver.getSession() with args: ["e4532345-1c97-44e7-b760-9192d9f3a430"] [UiAutomator2] Getting session details from server to mix in [WD Proxy] Matched '/' to command name 'getSession' [WD Proxy] Proxying [GET /] to [GET http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c] with body: {} [WD Proxy] Got response with status 200: "{\"sessionId\":\"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c\",\"status\":0,\"value\":{}}" [W3C (e4532345)] Responding to client with driver.getSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"Samsung J7Nxt","platformVersion":"8.1.0"},"platformName":"android","adbExecTimeout":200000,"appActivity":"com.lycamobile.selfcare.MainActivity","appPackage":"com.lycamobile.selfcare","autoGrantPermissions":true,"automationName":"UiAutomator2","deviceName":"5200050afec97485","platformVersion":"8.1.0","deviceUDID":"5200050afec97485","deviceApiLevel":27,"deviceScreenSize":"720x1280","deviceScreenDensity":320,"deviceModel":"SM-J701F","deviceManufacturer":"samsung","pixelRatio":2,"statBarHeight":48,"viewportRect":{"left":0,"top":48,"width":720,"height":1232}} [HTTP] <-- GET /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430 200 30 ms - 991 [HTTP] [HTTP] --> POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element [HTTP] {"value":"//android.widget.EditText[@bounds='[174,590][626,658]']","using":"xpath"} [W3C (e4532345)] Calling AppiumDriver.findElement() with args: ["xpath","//android.widget.EditText[@bounds='[174,590][626,658]']","e4532345-1c97-44e7-b760-9192d9f3a430"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [WD Proxy] Matched '/element' to command name 'findElement' [WD Proxy] Proxying [POST /element] to [POST http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/element] with body: {"strategy":"xpath","selector":"//android.widget.EditText[@bounds='[174,590][626,658]']","context":"","multiple":false} [WD Proxy] Got response with status 200: {"sessionId":"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c","status":0,"value":{"ELEMENT":"c5a427d0-dc16-4a12-bd18-9e2e484b9440"}} [W3C (e4532345)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"c5a427d0-dc16-4a12-bd18-9e2e484b9440","ELEMENT":"c5a427d0-dc16-4a12-bd18-9e2e484b9440"} [HTTP] <-- POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element 200 1019 ms - 137 [HTTP] [HTTP] --> POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element/c5a427d0-dc16-4a12-bd18-9e2e484b9440/value [HTTP] {"id":"c5a427d0-dc16-4a12-bd18-9e2e484b9440","text":"+447448132541","value":["+","4","4","7","4","4","8","1","3","2","5","4","1"]} [W3C (e4532345)] Calling AppiumDriver.setValue() with args: [["+","4","4","7","4","4","8","1","3","2","5","4","1"],"c5a427d0-dc16-4a12-bd18-9e2e484b9440","e4532345-1c97-44e7-b760-9192d9f3a430"] [WD Proxy] Matched '/element/c5a427d0-dc16-4a12-bd18-9e2e484b9440/value' to command name 'setValue' [Protocol Converter] Added 'value' property ["+","4","4","7","4","4","8","1","3","2","5","4","1"] to 'setValue' request body [WD Proxy] Proxying [POST /element/c5a427d0-dc16-4a12-bd18-9e2e484b9440/value] to [POST http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/element/c5a427d0-dc16-4a12-bd18-9e2e484b9440/value] with body: {"elementId":"c5a427d0-dc16-4a12-bd18-9e2e484b9440","text":"+447448132541","replace":false,"value":["+","4","4","7","4","4","8","1","3","2","5","4","1"]} [WD Proxy] Got response with status 200: {"sessionId":"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c","status":0,"value":""} [W3C (e4532345)] Responding to client with driver.setValue() result: "" [HTTP] <-- POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element/c5a427d0-dc16-4a12-bd18-9e2e484b9440/value 200 97 ms - 12 [HTTP] [HTTP] --> POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element [HTTP] {"value":"//android.widget.Button[@bounds='[94,698][626,770]']","using":"xpath"} [W3C (e4532345)] Calling AppiumDriver.findElement() with args: ["xpath","//android.widget.Button[@bounds='[94,698][626,770]']","e4532345-1c97-44e7-b760-9192d9f3a430"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [WD Proxy] Matched '/element' to command name 'findElement' [WD Proxy] Proxying [POST /element] to [POST http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/element] with body: {"strategy":"xpath","selector":"//android.widget.Button[@bounds='[94,698][626,770]']","context":"","multiple":false} [WD Proxy] Got response with status 200: {"sessionId":"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c","status":0,"value":{"ELEMENT":"8edae992-8bd8-4725-ac1c-2ec27d440711"}} [W3C (e4532345)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"8edae992-8bd8-4725-ac1c-2ec27d440711","ELEMENT":"8edae992-8bd8-4725-ac1c-2ec27d440711"} [HTTP] <-- POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element 200 587 ms - 137 [HTTP] [HTTP] --> POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element/8edae992-8bd8-4725-ac1c-2ec27d440711/click [HTTP] {"id":"8edae992-8bd8-4725-ac1c-2ec27d440711"} [W3C (e4532345)] Calling AppiumDriver.click() with args: ["8edae992-8bd8-4725-ac1c-2ec27d440711","e4532345-1c97-44e7-b760-9192d9f3a430"] [WD Proxy] Matched '/element/8edae992-8bd8-4725-ac1c-2ec27d440711/click' to command name 'click' [WD Proxy] Proxying [POST /element/8edae992-8bd8-4725-ac1c-2ec27d440711/click] to [POST http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/element/8edae992-8bd8-4725-ac1c-2ec27d440711/click] with body: {"element":"8edae992-8bd8-4725-ac1c-2ec27d440711"} [WD Proxy] Got response with status 200: {"sessionId":"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c","status":0,"value":true} [W3C (e4532345)] Responding to client with driver.click() result: true [HTTP] <-- POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element/8edae992-8bd8-4725-ac1c-2ec27d440711/click 200 64 ms - 14 [HTTP] [HTTP] --> POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element [HTTP] {"value":"//android.app.Dialog[@bounds='[20,514][700,814]']","using":"xpath"} [W3C (e4532345)] Calling AppiumDriver.findElement() with args: ["xpath","//android.app.Dialog[@bounds='[20,514][700,814]']","e4532345-1c97-44e7-b760-9192d9f3a430"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [WD Proxy] Matched '/element' to command name 'findElement' [WD Proxy] Proxying [POST /element] to [POST http://localhost:8201/wd/hub/session/b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c/element] with body: {"strategy":"xpath","selector":"//android.app.Dialog[@bounds='[20,514][700,814]']","context":"","multiple":false} [WD Proxy] Got response with status 200: {"sessionId":"b8acbd69-c7bd-45c0-bfd0-ba95a7369c9c","status":0,"value":{"ELEMENT":"22277c21-cc62-422c-be71-5daf4c2e7498"}} [W3C (e4532345)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"22277c21-cc62-422c-be71-5daf4c2e7498","ELEMENT":"22277c21-cc62-422c-be71-5daf4c2e7498"} [HTTP] <-- POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/element 200 612 ms - 137 [HTTP] [HTTP] --> POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/execute/sync [HTTP] {"script":"return (function(){return function(){var k=this;function l(a){return void 0!==a}function m(a){return\"string\"==typeof a}function aa(a,b){a=a.split(\".\");var c=k;a[0]in c||!c.execScript||c.execScript(\"var \"+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&l(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}}\nfunction ba(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b}function ca( [W3C (e4532345)] Calling AppiumDriver.execute() with args: ["return (function(){return function(){var k=this;function l(a){return void 0!==a}function m(a){return\"string\"==typeof a}function aa(a,b){a=a.split(\".\");var c=k;a[0]in c||!c.execScript||c.execScript(\"var \"+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&l(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}}\nfunction ba(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b}function ca(a,b,c){return a.call.apply(a.b... [W3C (e4532345)] Encountered internal error running command: NotImplementedError: Method is not implemented [W3C (e4532345)] at AndroidUiautomator2Driver.execute (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-android-driver/lib/commands/execute.js:14:11) [W3C (e4532345)] at curCommandCancellable._bluebird.default.resolve.then (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:301:66) [W3C (e4532345)] at tryCatcher (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/util.js:16:23) [W3C (e4532345)] at Promise._settlePromiseFromHandler (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/promise.js:512:31) [W3C (e4532345)] at Promise._settlePromise (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/promise.js:569:18) [W3C (e4532345)] at Promise._settlePromiseCtx (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/promise.js:606:10) [W3C (e4532345)] at _drainQueueStep (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:142:12) [W3C (e4532345)] at _drainQueue (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:131:9) [W3C (e4532345)] at Async._drainQueues (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:147:5) [W3C (e4532345)] at Immediate.Async.drainQueues (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/release/async.js:17:14) [W3C (e4532345)] at runCallback (timers.js:696:18) [W3C (e4532345)] at tryOnImmediate (timers.js:667:5) [W3C (e4532345)] at processImmediate (timers.js:649:5) [HTTP] <-- POST /wd/hub/session/e4532345-1c97-44e7-b760-9192d9f3a430/execute/sync 405 10 ms - 1816 [HTTP]

aldochristiaan commented 5 years ago

In my opinion, usage of @bounds on xpath is bad practice, because when you change the device, it will be changed too. Maybe you can try another attribute to get the element

Upma-10 commented 5 years ago

In my opinion, usage of @bounds on xpath is bad practice, because when you change the device, it will be changed too. Maybe you can try another attribute to get the element

Yes. I know. But, I've tried to use other attributes like classname and resourceid as well. But, they are also not working. Please guide me for this.

aldochristiaan commented 5 years ago

In my opinion, usage of @bounds on xpath is bad practice, because when you change the device, it will be changed too. Maybe you can try another attribute to get the element

Yes. I know. But, I've tried to use other attributes like classname and resourceid as well. But, they are also not working. Please guide me for this.

Can you attach the ui or view hierarchy ?

Upma-10 commented 5 years ago

In my opinion, usage of @bounds on xpath is bad practice, because when you change the device, it will be changed too. Maybe you can try another attribute to get the element

Yes. I know. But, I've tried to use other attributes like classname and resourceid as well. But, they are also not working. Please guide me for this.

Can you attach the ui or view hierarchy ?

I have used index instead of bounds and it's working. For your reference, I am attaching screenshot of Hierarchy. Please guide me for if condition. Screenshot 2019-08-29 at 2 52 56 PM