Set text in a field but when run it says Element not Found

Hi,

Im trying to put an email address on email field but everytime I run my test script it says “web element not found” (full image below) I tried using xpath , css , attributes, adding waitForElement, used ChroPath to validate xpath but nothing works. Please help.

!

Hi @sarah2

I reproduced your problem, frankly I can’t explain why your XPath is not working because when I open the inspection tool on Chrome and enter the XPath it detects successfully the element.

Anyway, I recommend this XPath instead since I tried it on playback and it works.

(.//*[normalize-space(text()) and normalize-space(.)='Email address'])[1]/following::input[1]

Hi,
It feels strange. I think the problem is not your XPath : I tried loading directly the forgot-password page to validate the xpath , used setText, and it is working with your xPath.

In order to reproduce (because your screen capture is real), I repeated every step you did. I was able to get the same message “Unable to find the element located by xpath…” with Chrome (but not Firefox) because the click on “forgot pass” didn’t load the forgot-password page. Your waitForPageLoad is valid, because even if your click wasn’t working, your page is fully loaded ^^ Can you confirm that the forgot-password page isn’t loaded after the click on “forgot password” when you have the error message ?

If I add a delay (1 second) between the first click and the second, it is working (the forgot-password page is loaded after the click - and the xpath is working). Another solution is to click your TestObject using javascript.

WebUI.click(findTestObject(‘Object Repository/TestXPATH/login’))
WebUI.delay(1)
WebUI.click(findTestObject(‘Object Repository/TestXPATH/forgotPw’))
WebUI.setText(findTestObject(‘TestXPATH/AbsRel’), ‘sa’)

Hi @Antoine_Bulteau
Yes, I’ve observed too when I played back my script, forgot password-page was not loaded after clicking the Forgot Password link. That’s also another thing I did not understand , after performing the action=click(automated) it should be redirected to the Forgot password-page right?

http://forum.katalon.com/t/how-to-get-a-redirect-to-another-site-after-submitting-the-form/8182/4

Anyways, thank you so much for taking time to replicate and answer my question. I tried adding Delay before clicking the forgot pass link and yeahh its working, thank you so much its highly appreciated :blush:

It does if your element has something to do with the click ^^ In your case, the logic behind the click of your element is not fully loaded. I had similar issues with Angular and Chrome : it is beyond my knowledge. A new function has been introduced to adress this kind of issues (WebUI.waitForAngularLoad(0)), but in my case it is only working when Chrome is not running of first plan (very strange :upside_down_face: !) So this is a work in progress :wink: