Forum Discussion

aceishigh's avatar
aceishigh
Contributor
12 years ago

How to access popup browser window elements?

Hi All,

I have a web application that shows help in a browser window popup. The address bar and buttons are disabled in this popup. I'm trying to access the search, index and find buttons on this screen but I'm having trouble since the page object doesn't seem to be available for that window.

Is there some way of accessing elements of a child browser window such as help?

Any help/tips would be very appreciated.

Thanks,

J.

6 Replies

  • Here's the code I use to try to access elements of the browser help popup screen. No matter what I do, it doesn't seem to the find the button on the help screen.

    Any idea what I'm doing wrong?

    Thnaks,

    J.



    Sub ClickHelpItem(idStrName)

    'Getting page of help screen

    'Set objHelpPage = Sys.Browser.BrowserWindow(1)

    Set objHelpWindow = Sys.Browser.BrowserWindow(1)

    strProp = "idStr"

    strValues = idStrName

    Set objHelpElement = objHelpWindow.FindChild(strArray,strArray,100,True)

    objHelpElement.Click



    'Clean up

    Set objHelpElement = Nothing

    Set objHelpWindow = Nothing

     

    End Sub
  • Update: The above code works fine on IE9 but not Firefox or Chrome.

    Any help is appreciated.

    J.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Jack,


     


    It is not clear what issue you faced. Do you get any errors in the Test Log? What is their text? What TestComplete behavior do you observe when executing the test in Chrome or Firefox?

  • Thanks for your reply Tanya. Sorry if my description wasn't clear.

    I have a browser page and when I click on the Help button, it creates a browser window with help items. The help window has the address bar and menu disabled. I'm trying to access the new browser window, identified by TC as browserwindow(1).

    Please see the attached vbscript code that I use. It works fine on IE9 - TC identifies the help object by ID and clicks on it.

    However, when I run the same code in Firefox or Chrome, I get an error saying the object with specified attributes cannot be found.

    I've been using TC for over a year now and this is a strange problem.

    If I can provide any further information, please let me know.

    Thanks,

    J.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Jack,


     


    It looks like your attachment was blocked. Could you please zip the script file and attach the archive one more time? Besides, it would be great if you posted here the MHT Test Log so that we could clearly understand the error you get.