c# - Selecting element in a collection of buttons by text -
i trying loop through collection of button objects in silverlight web page (there 175 button objects) find button has text value = 'airport". not know how text property using webaii (c#). please help. below code have set together. '????' parts stuck. also, unsure of how double click element when have found 1 looking for, if here here appreciated.
var buttons2 =_silverlightapp.find.allbytype<textblock>(); (int = 0; < buttons2.count+ 1; i++) { if(buttons2.??????.text = "airport") { int elementnum = i; ??????.leftdoubleclick; } }
i don't know if buttons
displaying created dynamically in case ordinary button
, declared somewhere in xaml recommend using automationids
.
<button content="woohoo airport! omg!" automationproperties.automationid="airportbutton"/>
the webaii class visualfind
offers
public frameworkelement byautomationid(string id)
and can phone call on (webaii-)silverlightapp or on (webaii-)frameworkelement
silverlightapp.find.byautomationid("airportbutton"); frameworkelement.find.byautomationid("airportbutton");
c# silverlight automation webaii
No comments:
Post a Comment