Using Spy with 2 browser tabs open

Ask general questions here.
Eamonn
Posts: 63
Joined: Wed Jul 16, 2014 9:30 am
Location: Dundalk, Ireland.

Using Spy with 2 browser tabs open

Post by Eamonn » Tue Feb 07, 2017 12:23 pm

I am testing web applications. I am using Ranorex Studio 6.1. The first application is a client portal available on the Google Chrome browser. When I open the portal using the Google Chrome, I can view the web-elements using the Ranorex Spy. I have created recorded modules for testing the web pages. I have a second application which is a webpage containing iframe elements. Again, I have no difficulty tracking its web elements on the Google Chrome browser using the Ranorex Spy and creating recorded modules.
My problem is when I have both applications open in different tabs on the Google Chrome browser. My tests are failing because they can't locate web-elements within the individual web-pages when both tabs are open.
I tried to use the Ranorex Spy to track the individual web-elements but I am unable to access single elements. I can't highlight inside either tab.
The tests were created using an earlier version of Ranorex.
I have followed the advice in post http://www.ranorex.com/forum/validation ... t7152.html without success. Is there an Add-on that I may be missing which would solve my issues? Or has anyone experienced the same difficulties and found a solution?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Using Spy with 2 browser tabs open

Post by odklizec » Tue Feb 07, 2017 12:39 pm

Hi,

Unfortunately, it's pretty hard to suggest something reliable without seeing at least Ranorex snapshot (not screenshot) from both apps and exact xpath stored in repository for failing elements. Is it absolutely necessary to have both apps open? I mean, can't you just test the first app, then close it and open and test the second app? If you need both apps open at the same time, then you will have to find xpaths, which are unique for each app. There is no way around. Unfortunately, it's impossible to suggest something reliable without seeing at least Ranorex snapshot ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Eamonn
Posts: 63
Joined: Wed Jul 16, 2014 9:30 am
Location: Dundalk, Ireland.

Re: Using Spy with 2 browser tabs open

Post by Eamonn » Tue Feb 07, 2017 5:14 pm

Hi odklizec, thanks for your reply.
It is client content and thus I am restricted on how much I can publish.
The reason both are opened simultaneously is that the test case opens a portal via the web, actions are taken and data entered, then a second application is opened, in a second tab, to add necessary information to progress the data entry into the first application opened in the first tab. It is at this point where both tabs are open that Ranorex is unable to access the individual elements.
I will check if I can provide some snapshot content.
The issue does not appear to be happening on FF browser but I am manually opening the applications on the FF browser rather that the test case doing all the necessary steps to open the applications.

Edit 8th Feb 2017.
I created a new Ranorex solution, created a recorded module which opened two applications (Clicktime.com and USPS.com) on separate tabs in a single window of Google Chrome browser. When I ran the module an both apps were open on the browser I tried to view individual elements in the tab that had the focus. I was unable to access the elements.
I have attached an image of the Ranorex Spy window, I noticed the Google Chrome tab which did not have the focus is not included in the list in the Browser&Results view.
RanorexBrowserResults.JPG
I have also attached a Ranorex snapshot of the two applications.
ClickTime.rxsnp
USPS.rxsnp
I hope this additional information allows you investigate my issue further and you may be able to provide me with further assistance on this matter?
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Using Spy with 2 browser tabs open

Post by odklizec » Fri Feb 10, 2017 9:04 am

Hi,

Thanks for additional details and snapshots. The first thing I've noticed is that you are using an outdated Ranorex version. Please install the latest Ranorex 6.2.1. Additionally, please make sure you are using latest Chrome.

There was a similar problem to yours posted here:
http://www.ranorex.com/forum/can-t-iden ... 10521.html
The solution is to install and use latest Ranorex and Chrome ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Eamonn
Posts: 63
Joined: Wed Jul 16, 2014 9:30 am
Location: Dundalk, Ireland.

Re: Using Spy with 2 browser tabs open

Post by Eamonn » Fri Feb 10, 2017 4:54 pm

Thank you very much for your help.

Eamonn
Posts: 63
Joined: Wed Jul 16, 2014 9:30 am
Location: Dundalk, Ireland.

Re: Using Spy with 2 browser tabs open

Post by Eamonn » Wed Jun 14, 2017 4:37 pm

I have followed your advice and the advice contained in https://www.ranorex.com/forum/can-t-ide ... 10521.html.
However, the issues remain, I am unable to access elements on the tab visible when two tabs are open in the Chrome browser.
I am using Ranorex 6.2.1 and must remain at this version and I have the 10.0.10 version of Ranorex Extensions for Chrome, I am using Chrome version 59.0.3071.86.
Also, the spy is unable to gain access or visibility of the Chrome browser when two tabs are open.
Any further advice that may resolve these issues would be greatly appreciated.
Also, could you advise on how to close the tab that does not have focus when two tabs are open, using a recorded module or code module?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Using Spy with 2 browser tabs open

Post by Support Team » Fri Jun 16, 2017 1:04 pm

Hi Eamonn,

There was indeed a similar issue, but this issue was fixed in the latest version of the Ranorex Extension for Chrome (1.0.10). In order to analyze your issue in detail I would suggest contacting us directly by email ([email protected]).

If you have two open tabs with the same URL, you could extend the RanoreXPath of the repository item with the visible-attribute of the dom element.

Code: Select all

/dom[@domain='www.ranorex.com' and @visible='False']
After that, you can execute the Close Application action for the corresponding repository item, which will only close the invisible tab.

We look forward to hearing from you.

Kind Regards,
Johannes

Eamonn
Posts: 63
Joined: Wed Jul 16, 2014 9:30 am
Location: Dundalk, Ireland.

Re: Using Spy with 2 browser tabs open

Post by Eamonn » Mon Jun 19, 2017 1:37 pm

Each tab has a different URL, I would like to switch focus from the tab that has visible = 'true' to the tab that has visible = 'false' so that I can close that application. Can you advice or suggest how to switch the focus from one tab to the other in code?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Using Spy with 2 browser tabs open

Post by Support Team » Tue Jun 20, 2017 1:00 pm

Hi Eamonn,

For example, you could use the following code to search and switch to the corresponding tab. In addition to the visible attribute I would suggest using another attribute to uniquely identify the correct tab (for example, the browsername).

Code: Select all

public void SwitchFocus()
{
      WebDocument dom = Host.Local.FindSingle<WebDocument>("/dom[@visible='False' and browsername='Mozilla']");
      dom.EnsureVisible();        	                                                     
}
I hope this information will help you.

Sincerely,
Johannes