Using localhost in browser start and RanoreXPath

Ask general questions here.
Eike
Posts: 12
Joined: Wed Jul 10, 2019 9:50 am

Using localhost in browser start and RanoreXPath

Post by Eike » Mon Jul 06, 2020 4:43 pm

Hello!

For testing our web site, we got a global variable $URL that's used to start the browser as well as for domain recognition in RanoreXPaths (/dom[@domain='$URL']//divtag...). This works fine for teh real server domain names, but does not work for early testing on localhost:port. If we're using the URL without prepended "http://", as we usually do, chrome doesn't open the page but stays empty (I veryfied this behaviour from the command line). If we're prepending the protocol definition, the XPaths stop working.

What to do?

Is there a way for RanoreX to open the page given even if it's localhost?
Could I calculate a second global variable from the first one by string concatenation?
(This is to avoid yet another global variable to be filled manually...)

Stay safe / Gesundheit!
Eike

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

Re: Using localhost in browser start and RanoreXPath

Post by odklizec » Tue Jul 07, 2020 7:48 am

Hi Eike,

And what happens if you use "http://localhost...."? I think there should be no problem with using http:// even if you are using localhost? ;) Have you tried to open the localhost page this way manually (via standalone web browser)?
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

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Using localhost in browser start and RanoreXPath

Post by Stub » Tue Jul 07, 2020 9:10 am

Eike, you have just precisely described an issue we've encountered here in the past few days. My web testing experience is minimal to say the least, but we had the exact same issue with the browser opening on a blank page when we attempted to include a ":port" number on a local host. Because of what we're attempting to do right now I just worked around it with a second variable, but I have yet to go back to the issue to try and resolve in a better manner because I too share your concerns with that approach.

So, no solution for you, I've not poked into it too much, but we share a similar experience at least!

Eike
Posts: 12
Joined: Wed Jul 10, 2019 9:50 am

Re: Using localhost in browser start and RanoreXPath

Post by Eike » Tue Jul 07, 2020 9:28 am

odklizec wrote:
Tue Jul 07, 2020 7:48 am
And what happens if you use "http://localhost...."? I think there should be no problem with using http:// even if you are using localhost? ;) Have you tried to open the localhost page this way manually (via standalone web browser)?
With http://, the browser starts with the correct page - but the RanoreXPaths using the URL variable stop working.

Eike
Posts: 12
Joined: Wed Jul 10, 2019 9:50 am

Re: Using localhost in browser start and RanoreXPath

Post by Eike » Tue Jul 07, 2020 9:30 am

Stub wrote:
Tue Jul 07, 2020 9:10 am
So, no solution for you, I've not poked into it too much, but we share a similar experience at least!
It's good to hear I didn't miss something obvious to everybody else. ;)

If there's no solution but using a second variable, I think this would be a feature request to Ranorex:
Please enable starting a browser with a localhost:portnumber kind of URL if possible.