first find parent of item with custom data attributeĭiv.SearchProperties. Var browser = BrowserWindow.Launch(new Uri("index.html")) Usage: BrowserWindow.CurrentBrowser = "chrome" Return browserWindow.ExecuteScript(script, context) as T ![]() String controlDefinition = string.Format("\']\") " The following line of code did the trick for me: HtmlInputButton button = new HtmlInputButton(document) ī(new PropertyExpression(, "data-task-id=\"123\"", PropertyExpressionOperator.Contains)) Įxample method allowing you to pass in any attribute name and value: public HtmlInputButton InputButton(string attributeName, string attributeValue, UITestControl container = null) You can accomplish this by searching with the ControlDefinition as propertyname. Both answers worked equally well, and I didn't notice a performance difference between either one. Marcel's uses JavaScript to find the element, and AfroMogli's uses pure C# and the CodedUI API. Update: Thanks to both marcel de vries and AfroMogli for their answers. Web site delivered from localhost and is marked "trusted" in the Internet Options Security Settings.How I'm attempting to find the control: HtmlInputButton button = new HtmlInputButton(document) īutton.SearchProperties = "123" System.NotSupportedException: The property DataTaskId is not supported for this control. Share Improve this answer Follow edited at 2:10 Ryan M 17. It offers a way to initiate a Live testing session from within Visual Studio. I'm trying to use the SearchProperties and FilterProperties but I keep getting exceptions: 1 Answer Sorted by: 0 The BrowserStack Visual Studio plugin integrates with the 'Live' product, which is meant for manual testing. I would like to use this attribute and value to identify a button to click on. The button text is generic in each row ("Apply" and "Renew"), but the data-task-id attribute is unique. ![]() I'm finding it difficult to search for those button elements.Ī snippet of the HTML delivered to the browser: The ids and names of these buttons, while predictable because they use an index number, are not well suited to automation using SpecFlow and Coded UI Tests. I have a bunch of input buttons inside a GridView.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |