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

Checking to see if a control exists or not

2 Answers 245 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Talal
Top achievements
Rank 1
Talal asked on 15 Feb 2012, 06:18 AM
Hi Guys,

I have a situation where a textblock is created whose name is either 'TrueTextBlock' or 'FalseTextBlock'. Ignoring the fact it's quite a poor idea to change the name of a textblock based on the text content is there a way I can do something like this:

if(Pages.HardCatNextGen.SilverlightApp.FalseTextblock.Wait.ForExists(1000))


Where ForExists returns 'true' if FalseTextBlock exists and 'false' if FalseTextBlock does not exist.

ForExists works to check if a control exists (correct me if I'm wrong), however it doesn't return a true or false value if the control in question exists or doesn't.

Is there such a function I could leverage to do what I want?

Cheers

2 Answers, 1 is accepted

Sort by
0
Talal
Top achievements
Rank 1
answered on 17 Feb 2012, 06:21 AM
[bump]

Anyone have any ideas?
0
Cody
Telerik team
answered on 17 Feb 2012, 05:01 PM
Hi Talal,
I admit this is a bit tricky. Check out the following article:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/wait-for-element-to-exist-in-code.aspx

Near the bottom of the page you'll find Silverlight-specific info.


All the best,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Talal
Top achievements
Rank 1
Answers by
Talal
Top achievements
Rank 1
Cody
Telerik team
Share this question
or