6

I am using Selenium IDE Firefox plugin to create some test cases. I click the Record button to record the steps. When I am done, I stop the recording and would run the test cases to see how things go. In this one particular element in an HTML table, Selenium identifies as id=my_id_1 in the recording process; when I run the test case, it would say that Element id=my_id_1 not found.

How can it be not found when the ID is detected within Selenium IDE? How can I get around this problem? I have tried using //tr[4]/td[3]/a too. Using this approach (and using ID as well), when I click the Find button in the IDE, the corresponding item on the web page would be highlighted in yellow. However, the test case would fail saying that the element cannot find found.

Thanks in advance, Monte

Nat Ritmeyer
  • 5,634
  • 8
  • 45
  • 58
Monte Chan
  • 1,193
  • 4
  • 20
  • 42
  • Did you make sure that command is not getting executed before the table actually loaded in the page? – A.J Mar 21 '12 at 23:07

4 Answers4

8

Try a pause before the problem command to see if it isn't loaded completely before Selenium tries to find the element. If that fixes the problem, you can replace the pause with a more robust wait-for condition instead.

kenki
  • 538
  • 3
  • 4
0

May be it is creating a new ID every-time. Hence what you can do is give a regular expression like the one i used below.

//form[@id='adminLogin']/div/div[4]/input

Try it. This is worked for me.

shas
  • 703
  • 2
  • 8
  • 31
0

there may be the case that you are redirected to different page before execution of that command, so you are getting element not found error, you can put pause before execution of command, or if this is not a case then try to locate element by name, value or Xpath instead of ID

Rohit Ware
  • 1,982
  • 1
  • 13
  • 29
-1

run your test in slow mode of IDE.

yash
  • 1