How to get the page url before redirecting

Best practices, code snippets for common functionality, examples, and guidelines.
quynhnt
Posts: 8
Joined: Fri Jul 26, 2019 8:37 am

How to get the page url before redirecting

Post by quynhnt » Fri Sep 27, 2019 5:08 am

Hi All,

I am testing Chrome on desktop (Windows7/Windows10)
I am using Ranorex Studio 8.3

The flow runs as follows

1. Screen 01
2. Click link on Screen 01
3. Open Screen 02 (open new tab)
4. Screen 02 loading with page url is "abc.com"
5. "abc.com" is redirected to "def.com" before the load is completed (The time for redirect is very fast)

I want to get the page url at "abc.com" before redirecting to "def.com"
On ranorex, I used as follows

Action: Get value
Name: PageURL
Repository item: /dom[@domain='abc.com']
-> Error: Fail to find item. No element found for path /dom[@domain='abc.com'] within 30s

It seems that time for redirect is very fast, so it cannot perform get page url at "abc.com"

Please help me

Regard,
quynhnt

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

Re: How to get the page url before redirecting

Post by odklizec » Fri Sep 27, 2019 8:02 am

Hi,

I'm afraid, that without seeing the page in action, it would be very hard to suggest something reliable. What I would personally try, is to add domain 'def.com' to the existing DOM element 'abc.com', like this:
/dom[@domain='abc.com' or @domain='def.com']
This should prevent Ranorex from failing during element search. But I guess it's not what you are looking for? ;)
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

quynhnt
Posts: 8
Joined: Fri Jul 26, 2019 8:37 am

Re: How to get the page url before redirecting

Post by quynhnt » Fri Sep 27, 2019 8:44 am

Hi,

Thank your guide

after updating the DOM
Because the redirect time is very fast
it has get the page URL of the domain 'def.com'

What I look for is how to get the url of the domain 'abc.com'
I don't want to get the URL after redirecting

How to remove redirect?

Regard,

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

Re: How to get the page url before redirecting

Post by odklizec » Fri Sep 27, 2019 8:50 am

Hi,

I believe the redirection is handled by the webpage you are testing? So there is nothing Ranorex can do about this.

Your only hope how to get the URL of page abc.com is from the link, you are clicking on Screen 01. Could you please share a Ranorex snapshot (NOT screenshot) of the screen 01, in which we can analyze the link to screen 02?
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