I can't find my Element with waitForElementPresent

Hi,

I’m testing a “waitForElementPresent” on an element in a mobile app before a tap.
Unfortunately, Katalon doesn’t find my element.

Blockquote
03-10-2020 03:36:27 PM waitForElementPresent(findTestObject(“android.view.View0 - Mon profil”), 0)
Elapsed time: 1.237s
Failed to wait for element ‘’{0}’’ present (Root cause: java.lang.IllegalArgumentException: Object is null

I don’t understand why, because when I look the source of my page with this code :

AppiumDriver<?> driver = MobileDriverFactory.getDriver()
KeywordLogger log = new KeywordLogger()
log.logInfo(driver.getPageSource())
Mobile.waitForElementPresent(findTestObject('android.view.View0 - Mon profil'), 0)
Mobile.tap(findTestObject('android.view.View0 - Mon profil'), 0)

My result is :

  </android.view.View>
   <android.view.View index="7" package="" class="android.view.View" text="Mon profil" 
checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" 
long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,300]. 
[1080,450]" displayed="true" />

and the element is visible.

Why doesn’t Katalon see my element ?

Regards,

P

Mobile.waitForElementPresent(findTestObject(‘android.view.View0 - Mon profil’), 0)

Please replace ‘android.view.View0 - Mon profil’ by the correct mobile object ID (Right-click on object and choose Copy ID)

I m not sure to understand. The mobile Objet spy find my element. Where I can find the ID ?

It’s the created Mobile object with the same name after the previous record session

1 Like

It works. Thank you very much.

This helped me! Thanks!