Identify elements from pane

Ranorex Spy, Recorder, and Studio.
varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Identify elements from pane

Post by varun » Tue Dec 11, 2012 8:39 am

Hi Support,

Can you please tell me how to identify and click on links in provided snapshot ?

I am trying to identify path of one of available link as-

//table[#'FC_dgForecastProfileNavigationGrid']//td/a[@innertext='Histories']

But Sorry, Its wrong some where.

Thanks in advance,
Varun.
Attachments
FSettings_1211.rxsnp
FSettings
(201.4 KiB) Downloaded 199 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Wed Dec 12, 2012 11:28 am

Hi Varun,

Please check the value of the InnerText attribute with the Spy tool, then you will see that the InnerText is "8. Histories" and not "Histories", this is why Ranorex wasn't able to find the element, so please use one of the following RxPaths:

Code: Select all

//table[#'FC_dgForecastProfileNavigationGrid']//td/a[@innertext='8.Histories']//table[#'FC_dgForecastProfileNavigationGrid']//td/a[@innertext~'Histories']
Regards,
Markus
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Thu Dec 13, 2012 7:50 am

Hi Markus,

Thanks for post reply. Actually I was looking to get required element without using numbering bullets.

This pane is visible in 11 web pages but if I have to click on any of its element from any other page then its not working. Working fine if play the script(of click on element) on that page from which recording was done. RX Spy too not able to identify element by same way.
Is there any way to identify common elements from any of web page ?

This practice is also important to us because we have to play our scripts on different servers having different URL's but having same application.

Hope I have cleared my doubt.

Thanks,
Varun.

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Thu Dec 13, 2012 9:03 am

Hi Markus,

Sorry, it should also be added in previous post. Click event not working for the pane, can you please elaborate where I am wrong in the following code -

Code: Select all

InputTag path = Host.Local.FindSingle("/dom[@domain='xeonserver1']//table[#'FC_dgForecastProfileNavigationGrid']//tr/td/a[@innertext~'Window Mapping']");
Report.Info("Trying to find path; " + path.GetPath().ToString());
path.Click();
I am using same pane for which RX snapshot is attached in first thread of this post.

Thanks in advance,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Thu Dec 13, 2012 3:41 pm

Hi,

The RxPath should work but you are searching for an ATag and not for an InputTag, so please use this code:
ATag path = Host.Local.FindSingle("/dom[@domain='xeonserver1']//table[#'FC_dgForecastProfileNavigationGrid']//tr/td/a[@innertext~'Window Mapping']");
Report.Info("Trying to find path; " + path.GetPath().ToString());
path.Click();
, you have to make sure you declare the appropriate adapter type, when you are searching for an ATag you must also use an ATag adapter.

Regards,
Markus
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Mon Dec 17, 2012 5:26 am

Hi Markus,

Thank you for the information. It works now by replacing adapter.
I have a doubt regarding adapter, ATag ? What it's use and how many such adapters are there?
It will be great if you provide me with documents having such information on adapters ?

Thanks in advance,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Mon Dec 17, 2012 1:40 pm

Hi,
varun wrote:It will be great if you provide me with documents having such information on adapters ?
To get more information about the ATag adapter please have a look at the API documentation of the ATag adapter.

For an overview of all adapters have a look at the inheritance hierarchy of the adapter class.

To get a better understanding of adapters, please have a look at the section "Ranorex UI Adapter" in our user guide.

Regards,
Tobias
Ranorex Team
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Tue Dec 18, 2012 1:10 pm

Hi Markus,

Thank you for the references.
One point remain unanswered from one of our posts regarding,
varun wrote:This practice is also important to us because we have to play our scripts on different servers having different URL's but having same application.
As application is available on multiple servers but Script is running only on server on which it was recorded. And I have to run it on other servers too. So what needs to done for this ?

Thanks,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Tue Dec 18, 2012 3:30 pm

Hi,

I would use an attribute which is environment independent, did you already analyzed the available attributes of the specific element with the Spy tool?
Is there an attribute which doesn't change, which remains the same on different servers?

Regards,
Markus
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Wed Dec 19, 2012 10:21 am

Hi Markus,

Yes I have checked the attributes and they remain same on different servers, only there path changes. For instance, please find link of some elements verified on 2 servers -

Add button on Server 1:
/dom[@domain='xeonserver1' and @caption='Forecast Profiles' and @page='ListForecastProfiles.aspx' and @path='/NextGenR22_QA/ListForecastProfiles.aspx']//input[#'btnAdd']

Add button on Server 2:
/dom[@domain='xeonserver1' and @caption='Forecast Profiles' and @page='ListForecastProfiles.aspx' and @path='/NextGenProfitOpt2012.1/ListForecastProfiles.aspx']//input[#'btnAdd']

Radion option on Server 1:
/dom[@domain='xeonserver1' and @caption='Maintain Resource' and @page='AddOrUpdateResource.aspx' and @path='/NextGenR22_QA/AddOrUpdateResource.aspx']//input[#'rblIsConstrained_1']

Radion option on Server 2:
/dom[@domain='xeonserver1' and @caption='Maintain Resource' and @page='AddOrUpdateResource.aspx' and @path='/NextGenProfitOpt2012.1/AddOrUpdateResource.aspx']//input[#'rblIsConstrained_1']

Thanks,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Wed Dec 19, 2012 5:05 pm

Hi Varun,

You could for instance use the following RxPath:

Code: Select all

/dom[@domain='xeonserver1' and @caption='Forecast Profiles' or @caption='Maintain Resource']
for more detailes about the RxPath please take a look at the following links:
RanoreXPath
RanoreXPath – Tips and Tricks

Regards,
Markus
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Thu Dec 20, 2012 7:02 am

Hi Markus,

I think you take it in a wrong way. Let me clear this point with only one example.
If we talk about Add button of a page on 2 servers, say xeonserver1/NextGenR22_QA as Server 1 and xeonserver1/NextGenProfitOpt2012.1 as Server 2.

On analyzing Add button with Spy, it's observed that attributes remain same. Following are its Spy path on 2 different servers-
Server 1:
/dom[@domain='xeonserver1' and @caption='Forecast Profiles' and @page='ListForecastProfiles.aspx' and @path='/NextGenR22_QA/ListForecastProfiles.aspx']//input[#'btnAdd']

Server 2:
/dom[@domain='xeonserver1' and @caption='Forecast Profiles' and @page='ListForecastProfiles.aspx' and @path='/NextGenProfitOpt2012.1/ListForecastProfiles.aspx']//input[#'btnAdd']

Change is only in path(see red font above) of element. I already designed most of my Test Cases, so is there a way to play recorded Test Cases independent of Server/URL of application?

Thanks,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Fri Dec 21, 2012 3:21 pm

Hi Varun,

You could for instance delete it, for new records you could decrease the path weight for the "path" attribute in the Path Weights Editor of the Spy tool.
For more information please take a look at the attached screenshot:
PathWeightEditor.png
PathWeightEditor.png (225.23 KiB) Viewed 934 times
Regards,
Markus
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: Identify elements from pane

Post by varun » Wed Dec 26, 2012 6:00 am

Hi Markus,

Thank you for Screenshot. As you have mentioned, this instance is for new records but what would be the solution for the already recorded Test Cases/Scripts? Those scripts should also work on other servers.

Thanks in advance,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Identify elements from pane

Post by Support Team » Thu Dec 27, 2012 11:25 am

Hi,

You have to manually adapt the RxPath of the existing repo items of your repositories.
I suppose there is a root item in your repository which represents the RxPath to the root dom object, this single repo item has to be changed.

Regards,
Markus
.
Image