Reputation: 23
The numbers keep changing whenever we perform an action. I have tried the following and it still does not work
HtmlControl clickOnObjectivesCatg = new HtmlControl(bw);
clickOnObjectivesCatg.SearchProperties.Add(HtmlControl.PropertyNames.Id, "accordiongroup-5856-5055-tab", PropertyExpressionOperator.Contains);
Mouse.Click(clickOnObjectivesCatg);
Upvotes: 0
Views: 101
Reputation: 547
Try this:
var control = new HtmlControl(bw);
control.SearchProperties.Add(HtmlControl.PropertyNames.Id,
"accordiongroup",
PropertyExpressionOperator.Contains);
I think your problem is yours is checking if the control contains the precise ID, whereas you need to be only checking for the sub string if the number changes.
If you want to make this more reliable I would also suggest adding other search properties.
Upvotes: 1