How to use regular expression to find objects

May 20, 2011 at 11:38 AM

Hi,

I started using CUITe recently, I do have some queries

How to use regular expression 

e.g. public CUITe_HtmlSpan navigationbar = new CUITe_HtmlSpan("id=ctl00_Headerlinks");

Can we use regular expression to get only the id contains Headerlink, because the ct100 is changing for every refresh. Spoken to developer but no response.

Could you let me know how to do with CUITe.

Thanks & Regards,

Venkatesh

Coordinator
May 23, 2011 at 6:36 AM
Edited May 23, 2011 at 6:36 AM

Thanks Venkatesh for using CUITe!

For enabling regex, provide a "*" in the ObjectRepository entry.

 

public CUITe_HtmlSpan navigationbar = new CUITe_HtmlSpan("*");

 

Then in the test case,

pgObj.navigationbar.SetSearchPropertyRegx("id", "Headerlinks");
pgObj.navigationbar.Click();

SetSearchPropertyRegx checks for an element which contains the specified string.

 

Coordinator
Apr 27, 2012 at 7:41 PM
Edited Apr 27, 2012 at 7:42 PM

With recent code changes, this syntax no longer works as expected.

Here is the updated syntax:

 

public CUITe_HtmlSpan navigationBar { get { return Get<CUITe_HtmlSpan>("id~Headerlinks"); }}

 

Then in the test case:

pgObj.navigationbar.Click();

Coordinator
Sep 15, 2012 at 1:22 AM

See this work item:

http://cuite.codeplex.com/workitem/749

Oct 15, 2012 at 11:30 AM
icnocop wrote:

With recent code changes, this syntax no longer works as expected.

Here is the updated syntax:

 

public CUITe_HtmlSpan navigationBar { get { return Get<CUITe_HtmlSpan>("id~Headerlinks"); }}

 

Then in the test case:

pgObj.navigationbar.Click();

Hi icnopop,

 

Is this still working as I'm getting an error when trying to use this in CUITe v1.05:

Message "Search Parameter Format is not valid -> 'Innertext~Standard', should be like 'sKey1=sValue1;sKey2=sValue2;'"

when adding a cell type object to my OR

public CUITe_HtmlCell celUser { get {return Get<CUITe_HtmlCell>("Innertext~Standard");}}

Coordinator
Oct 15, 2012 at 9:31 PM

Yes, the new syntax still works with the latest source code available from the "Source Code" tab.

Oct 16, 2012 at 12:50 PM

D/loaded patch/build 20526 and am able to use the tilda as a regex to find my control.

Thanks

Feb 14, 2014 at 6:39 PM