This project is read-only.

Way to exclude search criteria

Jan 25, 2013 at 4:24 PM

Hi,

I ran into an interesting scenario today and I was wondering if there was a way to handle it within the CUITe framework.  The automation was trying to locate a span that looked like this based on the text in the span

The text in the span was 1023.92

However, when I ran the automation it was finding another span on the page.  This one with the same text

I solved this problem by specifying a "class=" like this 

Get<CUITe_HtmlSpan>("InnerText=1023.92;class=");

However, I wondered if there was a way to exclude search criteria.  I tired something like this but CUITe threw an error

Get<CUITe_HtmlSpan>("InnerText=1023.92;class!=TenderValueLabel");

Thanks

Jeff

BTW - I wanted to let everyone in the community know how much I appreciate the work that they put into CUITe and the help that I receive in this group, especially from icnocop.  We have been using CUITe to do our GUI automation and so far love it.

Jan 26, 2013 at 11:26 PM
Edited Jan 26, 2013 at 11:28 PM

Hi Jeff,

Thank you for your appreciation in the work put into CUIte and help provided to its users.  :)

Unfortunately, Coded UI does not support property expression operators other than EqualTo and Contains.

http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.propertyexpressionoperator.aspx

 

I suggest other ways to currently work around this limitation:

1. Specify a unique id attribute for the span element when rendered from the server and use it in the search

2. If the span elements are in a different hierarchy, retrieve the parent closest to the element and then call the Get<T>(...) method so that the scope of the search is limited to its immediate child elements.  For example, if using an html table, use the GetCell(...) method of CUITe_HtmlTable first to limit the search result returned to a specific set of child elements depending on their hierarchy in the DOM.

3. Call the GetChildren(...) method and iterate through the child elements until you find the element of interest

 

Thank you.