0

In a Selenium RC JUnit test, i have 2 assertTrue elements.
assertTrue("Incorrect element1",selenium.isElementPresent("element1"));
assertTrue("Incorrect element2",selenium.isElementPresent("element2"));

While debugging another problem, i purposely made the xpath to element1 invalid. Sometimes the test fails with the first assertTrue statement (expected), but sometimes it fails with the second one (weird) which means it passed the first assertTrue.
Can anyone guess what's happening?

2 Answers 2

2

You might have another element with same name and it may be that it is loading earlier than your expected element...Check for duplicate elements.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't know your page layout or load procedure but whenever i've had weird problems like this it's usually down to the page not having finished loading yet, or some JavaScript that hasn't run, or has run sooner that expected. I presume this isn't a static page we're talking about. Or alternately, there is some other element with the same name or ID on the page.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.