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

Checking element exists without timeoutexception?

2 Answers 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
macon
Top achievements
Rank 1
macon asked on 26 Apr 2010, 12:23 PM
Hello All,

I'm new to WebAii framework and I've got a question about the Wait class.

I have a scenario where I need to locate a table cell (td). I'm going to locate it by content but the content might be contained directly inside the cell or it might be the content of a child element of the table cell (e.g. a span).

I'm using:
Get<WebAiiHtmlControls.HtmlTableCell>("TextContent=" + textContent, "tagname=td");

The problem is that it times out and raises a System.TimeoutException (because in this instance the text is contained deeper inside a span). In this scenario I just want it to timeout and the Get() method to return null. Is this possible? I don't really want to insert try/catch into my code.

Thanks,
Matt

2 Answers, 1 is accepted

Sort by
0
Accepted
Missing User
answered on 26 Apr 2010, 04:47 PM
Hello Matt,

So if you use something like the following as your find expression:

HtmlTableCell c = ActiveBrowser.Find.ByExpression<HtmlTableCell>("TextContent=NeverFindAnything", "tagname=td");

c should return as null since the find uses the bad 'NeverFindAnything' find string.

But if you have some sort of html element within the td tag that contains the text you want to find, then you can try the following find expression:

HtmlTableCell c = ActiveBrowser.Find.ByExpression<HtmlTableCell>("InnerText=" + textContent, "tagname=td");

Please check out this online documentation, and the documentation and sample code in the WebAii Framework installation for more code references.

Greetings,
Nelson Sin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
macon
Top achievements
Rank 1
answered on 27 Apr 2010, 01:08 PM
Thanks for help
Tags
General Discussions
Asked by
macon
Top achievements
Rank 1
Answers by
Missing User
macon
Top achievements
Rank 1
Share this question
or