Forum Discussion

SriniG's avatar
SriniG
Contributor
10 years ago
Solved

How to access web page properties and methods available for the objects when multiple browser (IE11) window instances opening in Runtime.

Browser Used: IE11



Modal used: DOM



Actually I’m trying to keep the wildcard (*) instead of URL in page function ( Set page=Sys.browser (“iexplore”).page (“*).contentDocument) to get the page objects because in my project when I click on one button ( say ‘Edit Rates’) , “Rate plan detail” browser window will open! From ‘Rate plan detail’ page we need to modify the rates!

 

For that,

Set page=Sys.browser (“iexplore”).page (“*).contentDocument

Is working fine when only one browser window is exist with Page(“*”) for different URLs

But unable to get the page object when multiple instances of browser windows are opened

Test complete is unable to get the page objects because in the page function used (“*”).

I know if give the URL for each it will work but if page is opening dynamically then we don’t know the URL



For that I’m keeping the ‘*’.

 

Please let me know the steps to overcome this issue!



Thank you,

Srini

  • Hi Srini,



    Does the URL of the "Rate Plan Detail" page have some unique parts, such as query string parameter names? In this case you can mix them with wildcards to uniquely identify this page.



    For example, if the page URL is:

    http://example.com/rate-plan-detail?planname=KingRate



    you can use

    Sys.browser("iexplore").Page("*rate-plan-detail*")



    or

    Sys.browser("iexplore").Page("*?planname=*")



    or something like that.

4 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    is ther any way to use only "*" like if you check for different versions of IE we will use index numbers to coresponding versions are browsers.
    Using partial URLs like in my previous example is more stable.



    But if you want to use indexes, you can use FindAllChildren to get all opened pages:



    Dim pages, i

    pages = Sys.Browser().FindAllChildren("ObjectType", "Page")



    For i = 0 To UBound(pages)

      Call Log.Message(i & ": " & pages(i).URL)

    Next



    In this case your "Rate Plan Detail" page will probably be pages(1).



    is there any way to use only "*" without passing URL buy activating the page and then to acces the page.
    No. Sys.Browser().Page("*") always points to the first found page regardless of which page is currently active. You need to use partial or full URL instead of * to access specific pages.



    but locationURL property is not available.
    Hard to say without more context, but that code can misbehave if there're other browsers opened (Firefox, Chrome), so that Sys.Browser() matches a browser other than IE.
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Srini,



    Does the URL of the "Rate Plan Detail" page have some unique parts, such as query string parameter names? In this case you can mix them with wildcards to uniquely identify this page.



    For example, if the page URL is:

    http://example.com/rate-plan-detail?planname=KingRate



    you can use

    Sys.browser("iexplore").Page("*rate-plan-detail*")



    or

    Sys.browser("iexplore").Page("*?planname=*")



    or something like that.
  • Hi  Helen Kosova,



    Thankyou for the information. is ther any way to use only "*" like if you check for different versions of IE we will use index numbers to coresponding versions are browsers. 



    in that way is there any way to use only "*" without passing URL buy activating the page and then to acces the page.



    i'm enabling the page in this way to get the URL from the coresponding window.




    Dim window


      window = Sys.Browser().FindAllChildren("ObjectType", "BrowserWindow")


      Call Log.Message("Number of opened browser windows: " & (UBound(window) + 1))


      set page = sys.Browser("iexplore").Page("*")


      call window(0).Click


      log.message(Page.locationURL)


      call window(1).Click


      log.message(Page.locationURL)



    but locationURL property is not available.



    plz let me know if anything wrong in this.



    Thank you