Element with locator not found

2,047 views
Skip to first unread message

Satish Kumar

unread,
Jun 2, 2021, 5:35:56 AM6/2/21
to robotframework-users
Hello all,

I am using Input Text key word to input value Target in Search for an account text box and  I am getting  below error:
06.399 :  INFO : Typing text 'Target' into text field '//*[@id="l-content"]/div/div[1]/div/div[2]/div/input'.
20210602 17:27:06.659 :  INFO : </td></tr><tr><td colspan="3"><a href="selenium-screenshot-20.png"><img src="selenium-screenshot-20.png" width="800px"></a>
20210602 17:27:06.667 :  FAIL : Element with locator '//*[@id="l-content"]/div/div[1]/div/div[2]/div/input' not found.

P.S I have try using xpath but still no luck.
Am I missing any thing here , What to do if xpath or css selector is not identified. 
Or I am not using correct Key word ?

Please help

1.PNG
2.png

Ed Manlove

unread,
Jun 2, 2021, 7:55:47 AM6/2/21
to robotframe...@googlegroups.com

The error message given "Element with locator '...' not found." indicates that it can not find the element. This is generally a pretty trustworthy error message so it tends to indicate a specific set of problems. [If it were another error like "element not interactable" that would be indicating another set of problems.]

In such cases the first thing I do is to manual check to make sure the xpath is valid. The technique I use is outlined in this stackoverflow answer - https://stackoverflow.com/a/22573161. If this finds that xpath then the next item I check is to see if it is a timing issue. That is is my script running faster then the page or the page running some javascript and "not ready" yet.

A general technique to discover this is to put a Sleep keyword, making sure I get it enough time for the page to "settle", just before the input text keyword. and run the script several times over. If it passes every time then I tend to think it is a timing issues. To resolve timing issues there are several techniques including an explicit wait using the "Wait For ..." keywords or using one of the external third party libraries for implicit waiting, like Selenium Testibility - https://github.com/rasjani/robotframework-seleniumtestability - or if Angular site, the AngularJS Library - https://github.com/Selenium2Library/robotframework-angularjs.

That is my general steps to start debugging such an issue.

Ed

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/8d203a2d-7b08-4699-9b10-ecc7d54eb520n%40googlegroups.com.

Satish Kumar

unread,
Jun 2, 2021, 8:05:00 AM6/2/21
to devp...@verizon.net, robotframework-users
Hi Ed,
Thanks for your reply.
I have used  "Wait For ..." as per your suggestion..it works fine now. Thank you so much ...

Regards,
Satish

Reply all
Reply to author
Forward
0 new messages