problem with webdocument navigate method

Ranorex Spy, Recorder, and Studio.
ashishabrol
Posts: 13
Joined: Wed Feb 02, 2011 8:05 am

problem with webdocument navigate method

Post by ashishabrol » Wed Feb 02, 2011 8:20 am

Hi

I have recently started using ranorex and have an issue finding the correct syntax for navigating to a new website using ranorex.webdocument.navigate method.

Here is what I try to do
//find any open webpage - this works
Ranorex.WebDocument doc=Host.Local.FindSingle("/dom[@childIndex='1']");
//naviagte to new webpage - this doesnt work
doc.Navigate("www.twitter.com");

with above syntax ranorex instructs the web page to go to "www.oldpageurl.comwww.twitter.com". Which will never work.

can you someone tell me whats wrong?

thanks
Ashish Abrol

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

Re: problem with webdocument navigate method

Post by Support Team » Wed Feb 02, 2011 9:37 am

Hi,

you have to put a "http://" before your url, otherwise the the url you want to navigate to is taken relative to the existing url.

So your code schould look like this:
doc.Navigate("http://www.twitter.com");
Kind regards,
Tobias
Support Team
.
Image