I am trying to loop through a collection of button objects in a SilverLight web page (there are 175 button objects) to find a button that has the text value = 'Airport". But I do not know how to get to the text property using WebAii (C#). Please could somebody help. Below is the code I have put together. The '????' parts are were I am stuck. Also, I am unsure of how to actually double click the element when I have found the one I am looking for, so if you could here here to it would be most appreciated.
var buttons2 =_silverlightApp.Find.AllByType<TextBlock>();
for (int i = 0; i < buttons2.Count+ 1; i++)
{
if(buttons2.??????.text = "Airport")
{
int elementNum = i;
??????.LeftDoubleClick;
}
}
I don't know if the
Buttons
you are displaying are created dynamically but in case it is an ordinaryButton
, declared somewhere in your xaml I recommend usingAutomationIds
.the WebAii class
VisualFind
offersand you can call it on the (WebAii-)SilverlightApp or on a (WebAii-)FrameworkElement