Hi Jonah,
Thank you for your reply. In the below mentioned step i tried:
1) passing the WebElement reference to the tap function
2)passing the location of element based on cor-ordinates
MobileDriver mDriver=driver;
TouchAction tap = new TouchAction(mDriver);
1)tap.press(element).waitAction(1000).release().perform();
2)tap.press(element.getLocation().getX(),element.getLocation().getY()).waitAction(1000).release().perform();
Both attempts failed. Below are the logs for the same:
Server log when element is passed to tap:
> Starting Node Server
> info: Welcome to Appium v1.0.0 (REV f0a00fab2335fa88cb355ab4dc43a9cd3f3236c0)
> info: Non-default server args: {"address":"127.0.0.1","fullReset":true,"logNoColors":true}
> ERROR: debug: Appium request initiated at /wd/hub/session
> info: Looks like we want chrome on android
> ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"","appActivity":"com.google.android.apps.chrome.Main","appium-version":"1.0.0.0","appWaitActivity":"com.google.android.apps.chrome.Main","appPackage":"
com.android.chrome","version":"4.4.4"}}
> info: Creating new appium session cb9039af-f8d6-4c2a-bc71-6a67daa925b7
> ERROR: debug: executing: adb devices
> info: [ADB] Getting connected devices...
> info: [ADB] 1 device(s) connected
> info: Setting device id to 085d3b920c928938
> ERROR: debug: Pushing unlock helper app to device...
> ERROR: debug: executing: adb -s 085d3b920c928938 install "C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "dumpsys window"
> info: Writing dumpsys output to C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\.dumpsys.log
> ERROR: debug: Screen already unlocked, continuing.
> info: Creating Chrome session
> info: Ensuring Chromedriver exists
> info: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %b))
> info: No old chromedrivers seemed to exist
> info: Spawning chromedriver with: C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [CHROMEDRIVER] Starting ChromeDriver (v2.9.248315) on port 9515
> ERROR: debug: executing: adb -s 085d3b920c928938 devices
> info: [CHROMEDRIVER STDERR] [0.006][SEVERE]: Could not bind socket to
0.0.0.0:9515> info: [CHROMEDRIVER] Port not available. Exiting...
> info: Chromedriver exited with code 1
> info: [ADB] Getting connected devices...
> ERROR: error: Chromedriver create session did not work. Status was 200 and body was {"sessionId":"d55a6a515a6a4afff1ad454e7995b0e8","status":13,"value":{"message":"unknown error: Device 085d3b920c928938 is already in use\n (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)"}}
> info: Cleaning up appium session
> ERROR: error: Failed to start an Appium session, err was: Error: Did not get session redirect from Chromedriver
> info: Error: Did not get session redirect from Chromedriver
> at null.<anonymous> (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\lib\devices\android\chromedriver.js:195:12)
> at Request._callback (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\lib\devices\common.js:104:5)
> at Request.self.callback (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\node_modules\request\request.js:121:22)
> at Request.EventEmitter.emit (events.js:98:17)
> at Request.<anonymous> (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\node_modules\request\request.js:978:14)
> at Request.EventEmitter.emit (events.js:117:20)
> at IncomingMessage.<anonymous> (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\node_modules\request\request.js:929:12)
> at IncomingMessage.EventEmitter.emit (events.js:117:20)
> at _stream_readable.js:920:16
> at process._tickCallback (node.js:415:13)
> info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Did not get session redirect from Chromedriver)","origValue":"Did not get session redirect from Chromedriver"},"sessionId":null}
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "am force-stop
com.android.chrome"
> POST /wd/hub/session 500 1420ms - 242b
> info: [ADB] 1 device(s) connected
> info: Cleaning up appium session
> ERROR: debug: Appium request initiated at /wd/hub/session
> info: Looks like we want chrome on android
> ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"","appActivity":"com.google.android.apps.chrome.Main","appium-version":"1.0.0.0","appWaitActivity":"com.google.android.apps.chrome.Main","appPackage":"
com.android.chrome","version":"4.4.4"}}
> info: Creating new appium session 7864a23e-7345-446a-8455-dc191e8040b2
> ERROR: debug: executing: adb devices
> info: Trying to find a connected android device
> info: [ADB] Getting connected devices...
> info: [ADB] 1 device(s) connected
> info: Setting device id to 085d3b920c928938
> ERROR: debug: Pushing unlock helper app to device...
> ERROR: debug: executing: adb -s 085d3b920c928938 install "C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "dumpsys window"
> info: Writing dumpsys output to C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\.dumpsys.log
> info: Creating Chrome session
> ERROR: debug: Screen already unlocked, continuing.
> info: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %b))
> info: No old chromedrivers seemed to exist
> info: Spawning chromedriver with: C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [CHROMEDRIVER] Starting ChromeDriver (v2.9.248315) on port 9515
> info: Successfully started chrome session
> info: Overriding session id with "bbd9cf85844461f2b215d18aac1ff349"
> info: Device launched! Ready for commands
> info: Setting command timeout to the default of 60 secs
> info: Appium session started with sessionId bbd9cf85844461f2b215d18aac1ff349
> POST /wd/hub/session 303 6150ms - 9b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349
> ERROR: debug: Request received with params: {}
> GET /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349 200 6ms - 476b
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"bbd9cf85844461f2b215d18aac1ff349\",\"status\":0,\"value\":{\"acceptSslCerts\":true,\"applicationCacheEnabled\":false,\"browserConnectionEnabled\":false,\"browserName\":\"chrome\",\"chrome\":{},\"cssSelectorsEnabled\":true,\"databaseEnabled\":false,\"handlesAlerts\":true,\"javascriptEnabled\":true,\"locationContextEnabled\":true,\"nativeEvents\":true,\"platform\":\"ANDROID\",\"rotatable\":false,\"takesHeapSnapshot\":true,\"takesScreenshot\":true,\"version\":\"36.0.1985.131\",\"webStorageEnabled\":true}}"
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/url
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/url 200 2389ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//span[text()='No Thanks']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.11198481684550643-1"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 85ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-1/click
> ERROR: debug: Request received with params: {"id":"0.11198481684550643-1"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-1/click 200 186ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//input[@id='text']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.11198481684550643-2"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 40ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-2/value
> ERROR: debug: Request received with params: {"id":"0.11198481684550643-2","value":["Moto x"]}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-2/value 200 264ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//button[@id='_submit']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.11198481684550643-3"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 122ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-3/click
> ERROR: debug: Request received with params: {"id":"0.11198481684550643-3"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-3/click 200 3052ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//a/div/div[contains(text(),'Royal')]"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.21703581302426755-1"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 57ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.21703581302426755-1/location
> ERROR: debug: Request received with params: {}
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"bbd9cf85844461f2b215d18aac1ff349\",\"status\":0,\"value\":{\"toString\":{},\"x\":102,\"y\":937}}"
> GET /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.21703581302426755-1/location 200 26ms - 99b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/execute
> ERROR: debug: Request received with params: {"args":[""],"script":"window.scrollBy(0,102)"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/execute 200 9ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/touch/perform
> ERROR: debug: Request received with params: {"actions":[{"action":"press","options":{"element":"0.21703581302426755-1"}},{"action":"wait","options":{"ms":1000}},{"action":"release","options":{}}]}
> ERROR: debug: Proxied response received with status 404: "unknown command: session/bbd9cf85844461f2b215d18aac1ff349/touch/perform"
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/touch/perform 404 10ms - 71b
Server log with co-ordinates being passed:
> Starting Node Server
> info: Welcome to Appium v1.0.0 (REV f0a00fab2335fa88cb355ab4dc43a9cd3f3236c0)
> info: Non-default server args: {"address":"127.0.0.1","fullReset":true,"logNoColors":true}
> ERROR: debug: Appium request initiated at /wd/hub/session
> info: Looks like we want chrome on android
> ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"","appActivity":"com.google.android.apps.chrome.Main","appium-version":"1.0.0.0","appWaitActivity":"com.google.android.apps.chrome.Main","appPackage":"
com.android.chrome","version":"4.4.4"}}
> info: Creating new appium session cb9039af-f8d6-4c2a-bc71-6a67daa925b7
> ERROR: debug: executing: adb devices
> info: [ADB] Getting connected devices...
> info: [ADB] 1 device(s) connected
> info: Setting device id to 085d3b920c928938
> ERROR: debug: Pushing unlock helper app to device...
> ERROR: debug: executing: adb -s 085d3b920c928938 install "C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "dumpsys window"
> info: Writing dumpsys output to C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\.dumpsys.log
> ERROR: debug: Screen already unlocked, continuing.
> info: Creating Chrome session
> info: Ensuring Chromedriver exists
> info: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %b))
> info: No old chromedrivers seemed to exist
> info: Spawning chromedriver with: C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [CHROMEDRIVER] Starting ChromeDriver (v2.9.248315) on port 9515
> ERROR: debug: executing: adb -s 085d3b920c928938 devices
> info: [CHROMEDRIVER STDERR] [0.006][SEVERE]: Could not bind socket to
0.0.0.0:9515> info: [CHROMEDRIVER] Port not available. Exiting...
> info: Chromedriver exited with code 1
> info: [ADB] Getting connected devices...
> ERROR: error: Chromedriver create session did not work. Status was 200 and body was {"sessionId":"d55a6a515a6a4afff1ad454e7995b0e8","status":13,"value":{"message":"unknown error: Device 085d3b920c928938 is already in use\n (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)"}}
> info: Cleaning up appium session
> ERROR: error: Failed to start an Appium session, err was: Error: Did not get session redirect from Chromedriver
> info: Error: Did not get session redirect from Chromedriver
> at null.<anonymous> (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\lib\devices\android\chromedriver.js:195:12)
> at Request._callback (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\lib\devices\common.js:104:5)
> at Request.self.callback (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\node_modules\request\request.js:121:22)
> at Request.EventEmitter.emit (events.js:98:17)
> at Request.<anonymous> (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\node_modules\request\request.js:978:14)
> at Request.EventEmitter.emit (events.js:117:20)
> at IncomingMessage.<anonymous> (C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\node_modules\request\request.js:929:12)
> at IncomingMessage.EventEmitter.emit (events.js:117:20)
> at _stream_readable.js:920:16
> at process._tickCallback (node.js:415:13)
> info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Did not get session redirect from Chromedriver)","origValue":"Did not get session redirect from Chromedriver"},"sessionId":null}
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "am force-stop
com.android.chrome"
> POST /wd/hub/session 500 1420ms - 242b
> info: [ADB] 1 device(s) connected
> info: Cleaning up appium session
> ERROR: debug: Appium request initiated at /wd/hub/session
> info: Looks like we want chrome on android
> ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"","appActivity":"com.google.android.apps.chrome.Main","appium-version":"1.0.0.0","appWaitActivity":"com.google.android.apps.chrome.Main","appPackage":"
com.android.chrome","version":"4.4.4"}}
> info: Creating new appium session 7864a23e-7345-446a-8455-dc191e8040b2
> ERROR: debug: executing: adb devices
> info: Trying to find a connected android device
> info: [ADB] Getting connected devices...
> info: [ADB] 1 device(s) connected
> info: Setting device id to 085d3b920c928938
> ERROR: debug: Pushing unlock helper app to device...
> ERROR: debug: executing: adb -s 085d3b920c928938 install "C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "dumpsys window"
> info: Writing dumpsys output to C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\.dumpsys.log
> info: Creating Chrome session
> ERROR: debug: Screen already unlocked, continuing.
> info: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %b))
> info: No old chromedrivers seemed to exist
> info: Spawning chromedriver with: C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [CHROMEDRIVER] Starting ChromeDriver (v2.9.248315) on port 9515
> info: Successfully started chrome session
> info: Overriding session id with "bbd9cf85844461f2b215d18aac1ff349"
> info: Device launched! Ready for commands
> info: Setting command timeout to the default of 60 secs
> info: Appium session started with sessionId bbd9cf85844461f2b215d18aac1ff349
> POST /wd/hub/session 303 6150ms - 9b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349
> ERROR: debug: Request received with params: {}
> GET /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349 200 6ms - 476b
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"bbd9cf85844461f2b215d18aac1ff349\",\"status\":0,\"value\":{\"acceptSslCerts\":true,\"applicationCacheEnabled\":false,\"browserConnectionEnabled\":false,\"browserName\":\"chrome\",\"chrome\":{},\"cssSelectorsEnabled\":true,\"databaseEnabled\":false,\"handlesAlerts\":true,\"javascriptEnabled\":true,\"locationContextEnabled\":true,\"nativeEvents\":true,\"platform\":\"ANDROID\",\"rotatable\":false,\"takesHeapSnapshot\":true,\"takesScreenshot\":true,\"version\":\"36.0.1985.131\",\"webStorageEnabled\":true}}"
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/url
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/url 200 2389ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//span[text()='No Thanks']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.11198481684550643-1"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 85ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-1/click
> ERROR: debug: Request received with params: {"id":"0.11198481684550643-1"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-1/click 200 186ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//input[@id='text']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.11198481684550643-2"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 40ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-2/value
> ERROR: debug: Request received with params: {"id":"0.11198481684550643-2","value":["Moto x"]}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-2/value 200 264ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//button[@id='_submit']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.11198481684550643-3"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 122ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-3/click
> ERROR: debug: Request received with params: {"id":"0.11198481684550643-3"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.11198481684550643-3/click 200 3052ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//a/div/div[contains(text(),'Royal')]"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":{"ELEMENT":"0.21703581302426755-1"}}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element 200 57ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.21703581302426755-1/location
> ERROR: debug: Request received with params: {}
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"bbd9cf85844461f2b215d18aac1ff349\",\"status\":0,\"value\":{\"toString\":{},\"x\":102,\"y\":937}}"
> GET /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/element/0.21703581302426755-1/location 200 26ms - 99b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/execute
> ERROR: debug: Request received with params: {"args":[""],"script":"window.scrollBy(0,102)"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"bbd9cf85844461f2b215d18aac1ff349","status":0,"value":null}
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/execute 200 9ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/touch/perform
> ERROR: debug: Request received with params: {"actions":[{"action":"press","options":{"element":"0.21703581302426755-1"}},{"action":"wait","options":{"ms":1000}},{"action":"release","options":{}}]}
> ERROR: debug: Proxied response received with status 404: "unknown command: session/bbd9cf85844461f2b215d18aac1ff349/touch/perform"
> POST /wd/hub/session/bbd9cf85844461f2b215d18aac1ff349/touch/perform 404 10ms - 71b
> info: Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session...
> info: Killing chromedriver
> info: Chromedriver exited with code null
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "am force-stop
com.android.chrome"
> info: (killed by signal SIGTERM)
> info: Cleaning up appium session
> info: We shut down because no new commands came in
> ERROR: debug: Appium request initiated at /wd/hub/session
> info: Looks like we want chrome on android
> ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"","appActivity":"com.google.android.apps.chrome.Main","appium-version":"1.0.0.0","appWaitActivity":"com.google.android.apps.chrome.Main","appPackage":"
com.android.chrome","version":"4.4.4"}}
> info: Creating new appium session 92ce02dc-ded4-4f0d-8915-3df35bb1a817
> ERROR: debug: executing: adb devices
> info: [ADB] Getting connected devices...
> info: [ADB] 1 device(s) connected
> info: Setting device id to 085d3b920c928938
> ERROR: debug: Pushing unlock helper app to device...
> ERROR: debug: executing: adb -s 085d3b920c928938 install "C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> ERROR: debug: executing: adb -s 085d3b920c928938 shell "dumpsys window"
> info: Writing dumpsys output to C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\.dumpsys.log
> ERROR: debug: Screen already unlocked, continuing.
> info: Creating Chrome session
> info: Ensuring Chromedriver exists
> info: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %b))
> info: No old chromedrivers seemed to exist
> info: Spawning chromedriver with: C:\Users\mkarthik\Documents\selenium\AppiumForWindows\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [CHROMEDRIVER] Starting ChromeDriver (v2.9.248315) on port 9515
> info: Successfully started chrome session
> info: Overriding session id with "943c10a1d330ef9068d45e8554496903"
> info: Device launched! Ready for commands
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903
> info: Setting command timeout to the default of 60 secs
> ERROR: debug: Request received with params: {}
> info: Appium session started with sessionId 943c10a1d330ef9068d45e8554496903
> POST /wd/hub/session 303 6032ms - 9b
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"943c10a1d330ef9068d45e8554496903\",\"status\":0,\"value\":{\"acceptSslCerts\":true,\"applicationCacheEnabled\":false,\"browserConnectionEnabled\":false,\"browserName\":\"chrome\",\"chrome\":{},\"cssSelectorsEnabled\":true,\"databaseEnabled\":false,\"handlesAlerts\":true,\"javascriptEnabled\":true,\"locationContextEnabled\":true,\"nativeEvents\":true,\"platform\":\"ANDROID\",\"rotatable\":false,\"takesHeapSnapshot\":true,\"takesScreenshot\":true,\"version\":\"36.0.1985.131\",\"webStorageEnabled\":true}}"
> GET /wd/hub/session/943c10a1d330ef9068d45e8554496903 200 5ms - 476b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/url
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":null}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/url 200 2576ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//span[text()='No Thanks']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":{"ELEMENT":"0.3727641017176211-1"}}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element 200 94ms - 124b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.3727641017176211-1/click
> ERROR: debug: Request received with params: {"id":"0.3727641017176211-1"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":null}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.3727641017176211-1/click 200 245ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//input[@id='text']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":{"ELEMENT":"0.3727641017176211-2"}}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element 200 44ms - 124b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.3727641017176211-2/value
> ERROR: debug: Request received with params: {"id":"0.3727641017176211-2","value":["Moto x"]}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":null}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.3727641017176211-2/value 200 241ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//button[@id='_submit']"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":{"ELEMENT":"0.3727641017176211-3"}}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element 200 129ms - 124b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.3727641017176211-3/click
> ERROR: debug: Request received with params: {"id":"0.3727641017176211-3"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":null}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.3727641017176211-3/click 200 2039ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element
> ERROR: debug: Request received with params: {"using":"xpath","value":"//a/div/div[contains(text(),'Royal')]"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":{"ELEMENT":"0.28541846573352814-1"}}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/element 200 61ms - 125b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.28541846573352814-1/location
> ERROR: debug: Request received with params: {}
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"943c10a1d330ef9068d45e8554496903\",\"status\":0,\"value\":{\"toString\":{},\"x\":102,\"y\":937}}"
> GET /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.28541846573352814-1/location 200 12ms - 99b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/execute
> ERROR: debug: Request received with params: {"args":[""],"script":"window.scrollBy(0,102)"}
> ERROR: debug: Proxied response received with status 200: {"sessionId":"943c10a1d330ef9068d45e8554496903","status":0,"value":null}
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/execute 200 9ms - 85b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.28541846573352814-1/location
> ERROR: debug: Request received with params: {}
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"943c10a1d330ef9068d45e8554496903\",\"status\":0,\"value\":{\"toString\":{},\"x\":102,\"y\":937}}"
> GET /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.28541846573352814-1/location 200 17ms - 99b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.28541846573352814-1/location
> ERROR: debug: Request received with params: {}
> ERROR: debug: Proxied response received with status 200: "{\"sessionId\":\"943c10a1d330ef9068d45e8554496903\",\"status\":0,\"value\":{\"toString\":{},\"x\":102,\"y\":937}}"
> GET /wd/hub/session/943c10a1d330ef9068d45e8554496903/element/0.28541846573352814-1/location 200 13ms - 99b
> ERROR: debug: Appium request initiated at /wd/hub/session/943c10a1d330ef9068d45e8554496903/touch/perform
> ERROR: debug: Request received with params: {"actions":[{"action":"press","options":{"y":937,"x":102}},{"action":"wait","options":{"ms":1000}},{"action":"release","options":{}}]}
> ERROR: debug: Proxied response received with status 404: "unknown command: session/943c10a1d330ef9068d45e8554496903/touch/perform"
> POST /wd/hub/session/943c10a1d330ef9068d45e8554496903/touch/perform 404 3ms - 71b
Not sure why element is taken as fraction. Can you please have a look at it and and correct incase if i have made any mistake.
The code used is as shown below:
import static org.junit.Assert.*;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileDriver;
import io.appium.java_client.TouchAction;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.HasTouchScreen;
import org.openqa.selenium.interactions.TouchScreen;
import org.openqa.selenium.interactions.internal.Coordinates;
import org.openqa.selenium.interactions.touch.TouchActions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebElement;
//driver.executeScript("window.scrollBy(0,200)", "");
WebElement element = driver.findElement(By.xpath("//a/div/div[contains(text(),'Royal')]"));
try {
driver.executeScript("window.scrollBy(0,"+element.getLocation().getX()+")", "");
Thread.sleep(1000);
if(element!=null)
{
MobileDriver mDriver=driver;
TouchAction tap = new TouchAction(mDriver);
tap.press(element.getLocation().getX(),element.getLocation().getY()).waitAction(1000).release().perform();//unable to perform tap even with tap.press(element).waitAction(1000).release().perform();
//int x=element.getLocation().getX();
//int y=element.getLocation().getY();
break;
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}