I use Katalon Studio to run automation scripts against a hybrid application that I am loading on various mobile devices through Sauce Labs. Once the application loads successfully, I am running the following script to switch context over to WebView and then attempt to select an object on screen. I am able to successfully switch context over and print out the source code, but then the test case fails when trying to select my object without a helpful error message.
AppiumDriver<?> driver = MobileDriverFactory.getDriver(); Set<String> contextNames = driver.getContextHandles() println contextNames //Switch to web context Mobile.switchToWebView(FailureHandling.STOP_ON_FAILURE) //Print out the Source Code in the logs KeywordLogger log = new KeywordLogger() log.logInfo(driver.getPageSource()) //Tap object Mobile.tap(findTestObject('Object Repository/PX_PatientExperience/FAV_Favorites_Promotions/favorite_See_my_medicines'), 30)
I have also tried
WebUI.click(findTestObject('Object Repository/PX_PatientExperience/FAV_Favorites_Promotions/favorite_See_my_medicines'), 10)
instead of the Mobile.tap and both were unsuccessful.
The XPath being used by the Object is:
//favoritetext[contains(text(),"See my medicines")]
That section of the Source Code can be seen below:
<favoritetext ng-if="favorite.title" class="ng-binding ng-scope">See my medicines</favoritetext>
The only error in the logs is shown as:
2020-07-29 10:27:10.875 DEBUG testcase.BYOD_GetContexts - 5: tap(findTestObject("Object Repository/PX_PatientExperience/FAV_Favorites_Promotions/favorite_See_my_medicines"), 30, STOP_ON_FAILURE) Test case is failed
Anyone have any ideas on how to get this working?