Forum Discussion

khoffman90's avatar
khoffman90
Contributor
11 years ago
Solved

Alternative ways to navigate to a webpage

Hey, 



Is there any other ways of navigating to a web page other than using the ToURL or Navigate methods? One that doesn't care whether a page loads nor waits for one to load?



Thanks

Kim
  • Whenever I want to go back to my main page, I just kill all the processes from the browser, open a new one and start the new test...



    I don't know if this works for you...

10 Replies

  • jose_pita's avatar
    jose_pita
    Super Contributor

    I use a function with this code to navigate to a website:



    function navigate(){

    var AW = Sys.Browser("iexplore");


    Delay(1000,"");


    AW.Page("*").Keys("[F4]http://www.google.com[Enter]");


    AW.Page("*").Keys("^0");//this line puts the zoom to 100%

    }



    You can even use variables to go to whatever URL you want

  • Thanks,

    I'm using something similar in the meantime. I was just wondering if there was a method to do the job. I kinda wanted to avoid using keys and typing the address in. 
  • On further use this method also won't work in certain situations.



    For example:



    I'm half way through a test and want to return to my main page. Perhaps a dialog is also present. The focus is therefor not on the address bar and there is no ways to type in the address.

    This means I have to first focus/find the address bar... this is getting a little more complicated but not impossible. 



    On IE this is fine but I'm testing on all 5 browsers. Also Using the object spy it doesn't seem like TC can see chrome's adsress bar.  



    This is now alot more complicated then using a simple method like navigate. 



    The reason why I am not using navigate is as follows:



    on IE and Chrome every thing is Fine. The problem starts on FireFox.



    I'm half way through a test and something goes wrong so I enter the OnLogError event handler. 

    I want to return to my main page to start fresh for my next test so I want to *navigate* to it.

    However a pop up dialog appears asking me "are you sure you want to leave the current page?".



    On IE and chrome I can Find the dialog and click the button no problem and then the test continues to wait for the main page to load. 

    On Firefox it just gets stuck. Nothing happens. The dialog appears and it seems like its forever waiting for the next page to load it doesn't even attempt to find the dialog or button nor does it time out!







  • jose_pita's avatar
    jose_pita
    Super Contributor
    Whenever I want to go back to my main page, I just kill all the processes from the browser, open a new one and start the new test...



    I don't know if this works for you...
  • I'm not sure if that way will create more problems then it would solve. 

    Thanks for trying to help though. 



    If I don't get any more suggestions then I may have to think about reorganising my project inorder to do something different. 



    Thanks again!
  • Ravik's avatar
    Ravik
    Super Contributor
    Hi Kim , Try this -                                                                                                                                                                  Sub Browser

           Dim IE

           Set IE = CreateObject("InternetExplorer.Application")

           IE.Visible = true

           IE.Navigate"http://google.com"

           Delay(3000)

    End Sub
  • Thanks For the help guys. 



    This is no longer a problem for me as I spent a long time reorganising my project to make it better anyway.



    In this instance FF really didn't like the toURL method either. 



    Thanks again. 
  • chicks's avatar
    chicks
    Regular Contributor
    I'm running into this now myself.   It seems as if on Firefox, the page.toURL command hangs when it gets the "are  you sure you want to leave this dialog"  Kim,  I'm curious as to how you reorganized your project ?  Though I realize it has been a while.



    I will try using the keys method as a work-around.....
  • chicks's avatar
    chicks
    Regular Contributor
    This works:



    Browser = Sys.Process(browserToUse);


    page = Browser.Page("*");



    page.Keys("[F6]"+ newURL+ "[Enter]"// click navigate away popup



    Click(Sys.Browser(browserToUse).Page("*").Confirm.Button("OK") );