This project is read-only.

How to find a control dynamically

Sep 6, 2012 at 3:31 PM

I had a test where I clicked on a checkbox based on the search criteria I specified in the test in order to be able to avoid having to write hundreds of separate controls for the page.

I was using the technique in this discussion and I was using a version of the CUITE package that didn't include the update.

So what I used to do was CUITe_HtmlHyperlink x = new CUITe_HtmlHyperlink("*");

In my test code i'd use the x.SetSearchPropertyRegx("attribute", "value") to be able to search against whatever I wanted to for that so I'd click on the right control.

I ran into an issue updating to the latest DLL version that "*" option no longer works, and I have to use some new functionality. It seems this new functionality was designed for the case where I was trying to do a "Contains" versus being dynamic and choosing what I want at a later point.

Is there a way to do this dynamic behavior now?


Sep 6, 2012 at 8:00 PM

I think I found a solution myself, I created a method to do the work in the page. That way I can just call the method and pass in the dynamic value to perform the action against. Here is an example.


public void CheckCategoryBox(string category)


CUITe_HtmlCheckBox uiCategoryCheckBox = Get<CUITe_HtmlCheckBox>("Value=" + category);