Issue: Tap on mobile button passes but doesn't actually tap

I’m having an issue where I’ve captured the button through spy mobile, and ran a test to tap the button, says it’s passed, but when I look at the playback, the test doesn’t actually tap the button! I don’t understand why if anyone has had this issue or any solutions to try I’m all ears.

So far I’ve tried changing the attributes to the xpath, I tried adding the x and y coordinates. I even tried the method to tap at the location where the button is… I did read somewhere about frames and you can switch the frame to reach the element, but I only saw posts related to webui. Is there something similar I could do for mobile? Any help is appreciated

Could you please use Tap and Hold feature, it should work. you are facing issue with android or iOS?

The issue is with android, I’m unable to test with iOS at the moment. I tried to run with the tap and hold feature three times but keep getting this error:

09-18-2019 08:36:07 AM tapAndHold(findTestObject(“MenuButtonsRECAPTURED_JustATest/contactBTN”), 5, 20)

Elapsed time: 4m - 3.790s

Failed to tap and hold on element ‘Object Repository/MenuButtonsRECAPTURED_JustATest/contactBTN’ with duration 5 (Root cause: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: ESOCKETTIMEDOUT
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘LAPTOP-HJHROD33’, ip: ‘192.168.0.187’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {acceptSslCerts: true, app: /Users/spiffydev/Library/Ap…, appActivity: md51dfb42e1217f9a9b714b318b…, appOS: ANDROID, appPackage: com.gauged2.GetSpiffy, appUrl: https://kobiton-us-east.s3…, appVersionId: 41595, automationFramework: Katalon, automationName: UIAutomator2, captureSreenShots: true, chromedriverChromeMappingFile: /Applications/Kobiton.app/C…, chromedriverExecutableDir: /Applications/Kobiton.app/C…, databaseEnabled: false, desired: {acceptSslCerts: true, app: /Users/spiffydev/Library/Ap…, appActivity: md51dfb42e1217f9a9b714b318b…, appOS: ANDROID, appPackage: com.gauged2.GetSpiffy, appUrl: https://kobiton-us-east.s3…, appVersionId: 41595, automationFramework: Katalon, automationName: UIAutomator2, captureSreenShots: true, chromedriverChromeMappingFile: /Applications/Kobiton.app/C…, chromedriverExecutableDir: /Applications/Kobiton.app/C…, deviceName: Nexus 5X, deviceOrientation: portrait, fullReset: false, noReset: true, orientation: PORTRAIT, platformName: android, platformVersion: 8.1.0, sessionDescription: , sessionName: Automation test session, systemPort: 49297, udid: 00d9c9343f5c2250}, deviceApiLevel: 27, deviceManufacturer: LGE, deviceModel: Nexus 5X, deviceName: 00d9c9343f5c2250, deviceOrientation: portrait, deviceScreenDensity: 420, deviceScreenSize: 1080x1920, deviceUDID: 00d9c9343f5c2250, fullReset: false, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, orientation: PORTRAIT, pixelRatio: 2.625, platform: LINUX, platformName: Android, platformVersion: 8.1.0, sessionDescription: , sessionName: Automation test session, statBarHeight: 63, systemPort: 49297, takesScreenshot: true, udid: 00d9c9343f5c2250, viewportRect: {height: 1731, left: 0, top: 63, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 05eb4be7-6fdc-45e0-b2c8-3141c6847dbc
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:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)
at io.appium.java_client.PerformsTouchActions.performTouchAction(PerformsTouchActions.java:41)
at io.appium.java_client.TouchAction.perform(TouchAction.java:187)
at com.kms.katalon.core.mobile.helper.MobileElementCommonHelper.tapAndHold(MobileElementCommonHelper.java:106)
at com.kms.katalon.core.mobile.keyword.builtin.TapAndHoldKeyword$_tapAndHold_closure1.doCall(TapAndHoldKeyword.groovy:71)
at com.kms.katalon.core.mobile.keyword.builtin.TapAndHoldKeyword$_tapAndHold_closure1.call(TapAndHoldKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
at com.kms.katalon.core.mobile.keyword.builtin.TapAndHoldKeyword.tapAndHold(TapAndHoldKeyword.groovy:72)
at com.kms.katalon.core.mobile.keyword.builtin.TapAndHoldKeyword.execute(TapAndHoldKeyword.groovy:65)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.tapAndHold(MobileBuiltInKeywords.groovy:553)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$tapAndHold$4.call(Unknown Source)
at FixMenuButtons.run(FixMenuButtons:19)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1568810036779.run(TempTestSuite1568810036779.groovy:35)
)

Could you please little chang your code and add delay before tapping on the object, some times it will not sync along with that modify you tap and hold code like below

Mobile.delay(5)
tapAndHold(findTestObject(“MenuButtonsRECAPTURED_JustATest/contactBTN”), 0, 5)

Similar Issue I faced in iOS and solved it by adding Tap and Hold instead of Tap.

I resolved the issue. Ended up needing to add a delay after the tap. Thank you for your help anyway!

I also Got this problem in My Login test case Sign in Button.
I used this code and then I fixed my solution

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.android.AndroidDriver

import io.appium.java_client.MobileElement

Mobile.startExistingApplication(‘AppID’, FailureHandling.STOP_ON_FAILURE)

AndroidDriver driver = MobileDriverFactory.driver

MobileElement signInButton = (MobileElement)driver.findElementByAndroidUIAutomator(‘new UiSelector().resourceId(“kc-login”)’)
signInButton.click()

2 Likes