How to identify UI elements in iframe tag

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
skieur
Posts: 8
Joined: Mon Mar 06, 2017 11:20 am

How to identify UI elements in iframe tag

Post by skieur » Tue Mar 07, 2017 4:03 am

Hi expert,

We are currently facing an issue about how to identify UI elements in iframe tag. When running test case, ranorex can not find the UI elements. Our product is on desktop, technically iframe is already supported by Ranorex.

Operating system: win10
Ranorex version: 6.2.1
Browser: chrome Version 56.0.2924.87

The snapshot file is attached.


Also the screenshot of ranorex spy.
ranorex3.PNG
Thanks for your answers.
You do not have the required permissions to view the files attached to this post.
Last edited by skieur on Wed Mar 08, 2017 7:32 am, edited 1 time in total.

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

Re: How to identify UI elements in iframe tag

Post by odklizec » Tue Mar 07, 2017 8:32 am

Hi,

At first, Is it just Chrome specific issue? Have you tried it with other browsers?

At next, please check these posts regarding Chrome and iframes:
http://www.ranorex.com/forum/cross-doma ... t9163.html
http://www.ranorex.com/forum/all-of-a-s ... tml#p35556

Some more Chrome and iframe related posts can be found here:
http://www.ranorex.com/search.html?q=chrome%20iframe
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

skieur
Posts: 8
Joined: Mon Mar 06, 2017 11:20 am

Re: How to identify UI elements in iframe tag

Post by skieur » Tue Mar 07, 2017 8:46 am

Hi,

thank you for your quick response.

Yes, it's Chrome specific issue. In firefox, the input box in iFrame can be identified...This all happens after we use iframe for our login page...

And we added the web security flag, still the same...we are wondering whether it's because the path is not correctly written? Perhaps you could give a shot?

thanks a lot :D :D :D
Last edited by skieur on Wed Mar 08, 2017 7:33 am, edited 1 time in total.

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

Re: How to identify UI elements in iframe tag

Post by odklizec » Tue Mar 07, 2017 9:36 am

Hi,

If you start Chrome with parameters suggested in >this post<, it should work for you (worked for me). Here are the xpaths I was able to obtain in Chrome:

Code: Select all

/dom[@domain='hybris-cecenter-agenthome-ui-test-v1.us-east.modules.yaas.io']//iframe[#'signInTarget']//input[#'username']

/dom[@domain='hybris-cecenter-agenthome-ui-test-v1.us-east.modules.yaas.io']//iframe[#'signInTarget']//input[#'password']
The user data dir path should look like this:
C:\Users\username\AppData\Local\Google\Chrome\User Data\Default

BTW, Chrome always keeps some libs/exes open even after you close the main Chrome window. So if you want to make above trick working, you must first make sure there is no "Google Chrome" instance open in Win Task Manager.
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

skieur
Posts: 8
Joined: Mon Mar 06, 2017 11:20 am

Re: How to identify UI elements in iframe tag

Post by skieur » Tue Mar 07, 2017 9:55 am

Hi odklizec,

Still not working, the error log is:

Failed to find item 'CECenterAgentRepository.test.Self'.
No element found for path '/dom[@domain='hybris-cecenter-agenthome-ui-test-v1.us-east.modules.yaas.io']//iframe[#'signInTarget']//input[#'username']' within 30s.

I put the screenshot for the chrome settings here, in case I set it wrong...
ranorex5.PNG
The code snippet:

Code: Select all

            Report.Log(ReportLevel.Info, "Website", "Opening web site URL in variable $AgentHomeURL with browser 'Chrome' in maximized mode (with arguments --disable-web-security --user-data-dir=\"C:\\Users\\I330955\\AppData\\Local\\Google\\Chrome\\User Data\\Default\").", new RecordItemIndex(0));
            Host.Local.OpenBrowser(AgentHomeURL, "Chrome", "--disable-web-security --user-data-dir=\"C:\\Users\\I330955\\AppData\\Local\\Google\\Chrome\\User Data\\Default\"", false, true, false, false, false);
            Delay.Milliseconds(0);
Somewhere is wrong?

thanks:)
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: How to identify UI elements in iframe tag

Post by odklizec » Tue Mar 07, 2017 10:06 am

I would suggest to start Chrome manually (with mentioned parameters) and check the login iframe with Ranorex Spy...just to be sure it's working if Chrome is started manually. If it does not work, then I guess there is some previous instance of Chrome still running in background. Check the Task Manager if there is no Google Chrome open.
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

skieur
Posts: 8
Joined: Mon Mar 06, 2017 11:20 am

Re: How to identify UI elements in iframe tag

Post by skieur » Tue Mar 07, 2017 10:39 am

I followed your suggestion..no can not identify the element..

1.Set the settings in Target, as figure below:
ranorex7.PNG
2. The settings is: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="C:\Users\I330955\AppData\Local\Google\Chrome\User Data\Default"

3.When open the chrome manually, it looks like:
ranorex6.PNG
4.Use track to capture the element, still can not identify the input box...There is a warning message on the right, says: Please make sure you have the Ranorex Extension.

We actually installed the extension for sure, but when adding extra web security flag to open chrome, it seems Ranorex Extension can not be activated...

So weird...I have no idea why it does not work :shock: :shock: :shock:
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: How to identify UI elements in iframe tag

Post by odklizec » Tue Mar 07, 2017 12:20 pm

1 and 2 Looks OK. You can ignore message in step 3. As for Ranorex extension, yes, it's disabled after first Chrome start with mentioned parameters, but it should be possible to re-enable it? At least it worked for me. Then after Chrome restart, Spy should work as expected. I just tried it on a completely different machine and it worked here as well.
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

skieur
Posts: 8
Joined: Mon Mar 06, 2017 11:20 am

Re: How to identify UI elements in iframe tag

Post by skieur » Wed Mar 08, 2017 7:32 am

Thanks man, it works!

Thank you so much for your help :lol: :lol: :lol:
odklizec wrote:1 and 2 Looks OK. You can ignore message in step 3. As for Ranorex extension, yes, it's disabled after first Chrome start with mentioned parameters, but it should be possible to re-enable it? At least it worked for me. Then after Chrome restart, Spy should work as expected. I just tried it on a completely different machine and it worked here as well.

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

Re: How to identify UI elements in iframe tag

Post by odklizec » Wed Mar 08, 2017 8:07 am

Great! I'm glad I could help ;)
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