This is a migrated thread and some comments may be shown as answers.

How to refer to an element that doesn't exist

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Cheryl
Top achievements
Rank 1
Cheryl asked on 09 Aug 2011, 05:30 AM
Hello

I have a login page.  If the login fails then an error message is displayed, otherwise the user is taken into the website.
I wanted to try an If else statement, and check if the error message is visible and if not then assume success and continue into the website.

However, if the login is successful, the error message label is not visible (and does not exist in the html code) and therefore the test fails with an unable to locate element error.

Unable to locate element. Details: Attempting to find [Html] element using Find logic (Html): [id 'Exact' ctl00_ContentPlaceHolder1_lblmessage] AND [tagname 'Exact' span]


Any suggestions?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 10 Aug 2011, 04:47 PM
Hello Cheryl,

I'm sorry you are experiencing this problem. I've been able to reproduce it and I've logged it as a bug. You can track its progress in our PITS system here.

It appears that when we use Wait.ForVisible in "if..else" statement Test Studio fires an error. Meanwhile you can use Wait.ForExists method until the problem is solved. 

Hope to here from you soon!

Best wishes,
Plamen
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Cheryl
Top achievements
Rank 1
answered on 15 Aug 2011, 12:38 AM
Ok, thanks Plamen
Tags
General Discussions
Asked by
Cheryl
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Cheryl
Top achievements
Rank 1
Share this question
or