Element recognition slow when using wildcard (?)

Ranorex Spy, Recorder, and Studio.
ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

Element recognition slow when using wildcard (?)

Post by ElSticky » Thu Apr 17, 2014 12:45 pm

In the past I made some tests for our software. The design of it has recently changed a little bit (some controls were changed) so I’m now getting into trouble with our tests.

Now for example the direct path is like:

Code: Select all

/form[@controlname='frmPTUser']/container[@controlname='toolStripContainer1']//element[@controlname='tabInfo_TabPage_000']/combobox[@controlname='cboDefineCustomer']/text[@controlid='1001']
To make it a bit more future proof (when design controls change) I would like to make it more robust. To do this I changed it to the following:

Code: Select all

/form[@controlname='frmPTUser']/container[@controlname='toolStripContainer1']/?//combobox[@controlname='cboDefineCustomer']/text[@controlid='1001']
This works OK but when running the test this step take about 4 seconds to find the control. Is there any way to make it perform faster?

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Element recognition slow when using wildcard (?)

Post by mzperix » Thu Apr 17, 2014 3:55 pm

Hi ElSticky,

I think the reason you left out the element[@controlname='tabInfo_TabPage_000'] is because there will be other open panes, am I right?

Try not to leave out the whole element, rather try to make the xpath look for the visible tabpage, and use regexp to search for the proper tabs.

Try to use this xpath:

Code: Select all

/form[@controlname='frmPTUser']/container[@controlname='toolStripContainer1']//element[@controlname~'tabInfo_TabPage' and @visible='True']/combobox[@controlname='cboDefineCustomer']/text[@controlid='1001']
Another option is to leave out the whole ? part:

Code: Select all

/form[@controlname='frmPTUser']/container[@controlname='toolStripContainer1']//combobox[@controlname='cboDefineCustomer']/text[@controlid='1001']
Or even to leave out the @controlname attribute:

Code: Select all

/form[@controlname='frmPTUser']/container[@controlname='toolStripContainer1']//element/combobox[@controlname='cboDefineCustomer']/text[@controlid='1001']