WebUI Testing on android fails

Hello, I’m trying to run a WebUI test on an android device, but it just won’t work.
I tried a test case I have to test the website I’m working on (after installing nodejs and appium), which passes all right on the computer but on android it fails at the first line after opening the browser.
I tried to pass some tests that I know they work, but on android none of them won’t work.

I created a really simple test case to try to make it work, but the same results occur.
This is the code:

 WebUI.openBrowser('')
 	
 WebUI.navigateToUrl('http://www.google.com/')
 WebUI.delay(3);
 WebUI.waitForElementVisible(findTestObject('google input'),30)

It should pass all right, and it opens the browser and goes to google, but it fails at the waitForElementVisible even without waiting the 30 seconds, it just fails. It says: “Unable to verify object ‘Object Repository/google input’ is visible.”
It fails with anything after navigating to url, and I don0t know what else to do.

I would really appreciate if anyone knows what’s going on. Thanks in advance!

Use Mobile Keyword to test on mobile

Hello Helene, thanks for responding.
So, I changed the WebUI.waitForelementVisible for this:

Mobile.waitForElementPresent(findTestObject(‘google input’),10)

But it’s still not working, I’m getting this error:

Test Cases/device test FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Failed to wait for element present >(Root cause: org.openqa.selenium.InvalidArgumentException: invalid argument: >Unsupported locator strategy: -android uiautomator

I’m testing a web page though, do I still have to use the Mobile keyword? Because I’ve seen some examples that use WebUI.

That’s true you can use WebUI, sorry for the mistake.
Try with an example from the doc
https://docs.katalon.com/katalon-studio/tutorials/running_application_mobile_browsers.html#what-youll-learn

Edit : for your error see

Hi @ricard,

  • Please show full execution log and XPATH of the element google input
  • How to verify element is on page without using Mobile devices
  1. Setup Mobile Emulation.
  2. Right click on the object and select Add to Object Spy
  3. Start Chrome and press Verify And Highlight to find the element.

Thanks

Hello!
So, my xpath for the input is:

//*[@name = 'q']

and I did that mobile emulation thing, and I’m getting this for the input:

//input[@name='q']

which is just google’s search box.
And then the execution log is:

05-10-2019 08:44:29 AM Test Cases/device test

Elapsed time: 36,379s

Test Cases/device test FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Failed to wait for element present (Root cause: org.openqa.selenium.InvalidArgumentException: invalid argument: Unsupported locator strategy: -android uiautomator
(Session info: chrome=71.0.3578.99)
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘DESKTOP-LFB4O0G’, ip: ‘192.168.0.15’, 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 {browserName: Chrome, databaseEnabled: false, desired: {browserName: Chrome, deviceName: samsung SM-T535 (Android 4…, newCommandTimeout: 1800, platform: ANDROID, platformName: android, udid: 0da4d492}, deviceManufacturer: samsung, deviceModel: SM-T535, deviceName: 0da4d492, deviceScreenSize: 1280x800, deviceUDID: 0da4d492, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, platform: ANDROID, platformName: ANDROID, platformVersion: 4.4.2, takesScreenshot: true, udid: 0da4d492, warnings: {}, webStorageEnabled: false}
Session ID: 1aa66aff-ff51-4112-b4a0-647a1db76d0c
*** Element info: {Using=-android uiautomator, value=new UiSelector()}
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:164)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
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 org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:397)
at io.appium.java_client.DefaultGenericMobileDriver.findElements(DefaultGenericMobileDriver.java:54)
at io.appium.java_client.AppiumDriver.findElements(AppiumDriver.java:149)
at io.appium.java_client.FindsByAndroidUIAutomator.findElementsByAndroidUIAutomator(FindsByAndroidUIAutomator.java:39)
at com.kms.katalon.core.mobile.keyword.internal.MobileSearchEngine.findAndroidElements(MobileSearchEngine.java:152)
at com.kms.katalon.core.mobile.keyword.internal.MobileSearchEngine.findWebElement(MobileSearchEngine.java:252)
at com.kms.katalon.core.mobile.keyword.internal.MobileSearchEngine$findWebElement.call(Unknown Source)
at com.kms.katalon.core.mobile.keyword.internal.MobileAbstractKeyword.findElement(MobileAbstractKeyword.groovy:105)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword$_waitForElementPresent_closure1.doCall(WaitForElementPresentKeyword.groovy:72)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword$_waitForElementPresent_closure1.call(WaitForElementPresentKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword.waitForElementPresent(WaitForElementPresentKeyword.groovy:80)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword.execute(WaitForElementPresentKeyword.groovy:64)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.waitForElementPresent(MobileBuiltInKeywords.groovy:588)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$waitForElementPresent.call(Unknown Source)
at device test.run(device test:20)
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:336)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:327)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:306)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:298)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:232)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1557470668629.run(TempTestCase1557470668629.groovy:21)
)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:23)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword.waitForElementPresent(WaitForElementPresentKeyword.groovy:80)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword.execute(WaitForElementPresentKeyword.groovy:64)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.waitForElementPresent(MobileBuiltInKeywords.groovy:588)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$waitForElementPresent.call(Unknown Source)
at device test.run(device test:20)
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:336)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:327)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:306)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:298)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:232)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1557470668629.run(TempTestCase1557470668629.groovy:21)
Caused by: org.openqa.selenium.InvalidArgumentException: invalid argument: Unsupported locator strategy: -android uiautomator
(Session info: chrome=71.0.3578.99)
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘DESKTOP-LFB4O0G’, ip: ‘192.168.0.15’, 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 {browserName: Chrome, databaseEnabled: false, desired: {browserName: Chrome, deviceName: samsung SM-T535 (Android 4…, newCommandTimeout: 1800, platform: ANDROID, platformName: android, udid: 0da4d492}, deviceManufacturer: samsung, deviceModel: SM-T535, deviceName: 0da4d492, deviceScreenSize: 1280x800, deviceUDID: 0da4d492, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, platform: ANDROID, platformName: ANDROID, platformVersion: 4.4.2, takesScreenshot: true, udid: 0da4d492, warnings: {}, webStorageEnabled: false}
Session ID: 1aa66aff-ff51-4112-b4a0-647a1db76d0c
*** Element info: {Using=-android uiautomator, value=new UiSelector()}
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:164)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
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 org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:397)
at io.appium.java_client.DefaultGenericMobileDriver.findElements(DefaultGenericMobileDriver.java:54)
at io.appium.java_client.AppiumDriver.findElements(AppiumDriver.java:149)
at io.appium.java_client.FindsByAndroidUIAutomator.findElementsByAndroidUIAutomator(FindsByAndroidUIAutomator.java:39)
at com.kms.katalon.core.mobile.keyword.internal.MobileSearchEngine.findAndroidElements(MobileSearchEngine.java:152)
at com.kms.katalon.core.mobile.keyword.internal.MobileSearchEngine.findWebElement(MobileSearchEngine.java:252)
at com.kms.katalon.core.mobile.keyword.internal.MobileSearchEngine$findWebElement.call(Unknown Source)
at com.kms.katalon.core.mobile.keyword.internal.MobileAbstractKeyword.findElement(MobileAbstractKeyword.groovy:105)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword$_waitForElementPresent_closure1.doCall(WaitForElementPresentKeyword.groovy:72)
at com.kms.katalon.core.mobile.keyword.builtin.WaitForElementPresentKeyword$_waitForElementPresent_closure1.call(WaitForElementPresentKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
… 17 more

Thanks for the help, I’ve been trying lots of things, and I think I set everything correctly, but I don’t know.

hey Helene,
so, the truth is I don’t really know what that is or how to change it, but I’m gonna research that a bit now, thanks :slight_smile: