I have a bunch of input[type=submit] buttons inside a GridView. 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'm finding it difficult to search for those button elements.
A snippet of the HTML delivered to the browser:
<input type="submit" id="abc_xyz_0" data-task-id="123" value="Apply">
<input type="submit" id="qrs_tuv_0" data-task-id="345" value="Renew">
The button text is generic in each row ("Apply" and "Renew"), but the data-task-id attribute is unique. I would like to use this attribute and value to identify a button to click on. I'm trying to use the SearchProperties and FilterProperties but I keep getting exceptions:
System.NotSupportedException: The property DataTaskId is not supported for this control.
How I'm attempting to find the control:
HtmlInputButton button = new HtmlInputButton(document);
button.SearchProperties["data-task-id"] = "123";
// or button.SearchProperties["DataTaskId"] = "123";
Aucun commentaire:
Enregistrer un commentaire