Forum Discussion

pashooo's avatar
pashooo
Contributor
14 years ago

How to get webpage address

Hello! I tried to choose web page address with object spy, but didnt find the property, containing the address. The address area has only properties which in the screenshot.

3 Replies

  • Hi Pasha,



    To get the current page address, use:

    Aliases.iexplore.Page("*").URL


    To navigate to another page, use:

    Aliases.iexplore.ToUrl("http://www.newwebsite.com")
  • This is the code, I use:

    Log.message(Aliases.iexplore.Page("http://itglobal.ru/products/ow/manual/manual.aspx").URL)



    ... but have got an error:

    Unable to find the object Page("http://itglobal.ru/products/ow/manual/manual.aspx"). (the first Log.rar)



    The page http://itglobal.ru/products/ow/manual/manual.aspx is opened and it's tab is active.



    I also tried another way. I use record master, it generates such code: 

    aqObject.CheckProperty(Aliases.iexplore6.pageHttpItglobalRuProductsOwManu.panelTotal, "FullName", cmpNotEqual, "Sys.Process(\"iexplore\", 7).Page(\"http://itglobal.ru/products/ow/manual/manual.aspx\").Panel(\"total\")");

    ... but I  have got an error again (the second Log.rar)



    I want to verify is the page http://itglobal.ru/products/ow/manual/manual.aspx opened.

    Is there any other ways to do it?






  • Hi Pasha,



    It looks like the root cause of the problem is that your Internet Explorer version (8 or 9 - which one, by the way?) spawns multiple processes with different indexes, so you end up with iexplore, iexplore1, iexplore6, etc., and the web page belongs to different process instances at different times. That's why, the web page can't be identified properly.



    To avoid the problem, you need to configure Internet Explorer to use a single process as described here:

    Disabling Loosely Coupled Internet Explorer





    Once you have that fixed, you should be able to get the current page URL using the following expression:

    // using Name Mapping:

    Aliases.iexplore.FindChild(["ObjectType", "Visible"], ["Page", true]).URL



    // not using Name Mapping:

    Sys.Process("iexplore").FindChild(["ObjectType", "Visible"], ["Page", true]).URL



    (The URL expression I suggested in my previous post is incorrect.)



    To verify the URL using a checkpoint, you can use code similar to this:



    var currentPage = Sys.Process("iexplore").FindChild(["ObjectType", "Visible"], ["Page", true]);

    aqObject.CheckProperty(currentPage, "URL", cmpEqual, "http://itglobal.ru/products/ow/manual/manual.aspx");




    Let me know how this works out for you.