Automating Internet Explorer embedded in Java applications (Eclipse)

Last edited on

Overview

To automate Internet Explorer embedded in Java applications (for example the help viewer of Eclipse) the following things are required:

Add to Trusted Sites

It is required to add http://127.0.0.1 and any other URL where the HTML Files are being loaded from to Internet Explorer's Trusted Sites to allow the Squish component in the browser to communicate with the other Squish components.

To do this start Internet Explorer outside of Squish and then do the following:

Optional, alternative recording approach

The following steps should generally not be required, but might be useful in cases where straight recording of a complete test case does not yield commands for the Internet Explorer automation.

The recording must take place in two steps:

Step #1: Record until the embedded Internet Explorer is visible, then end recording.

The resulting script should look similar to this:

import names
def main():
    startApplication("eclipse")
    clickButton(waitForObject(names.Workspace_Launcher_OK_Button))
    activateItem(waitForObjectItem(names.Eclipse_Menu, "Help"))
    activateItem(waitForObjectItem(names.Help_Menu, "Help Contents"))

    ctx_1 = waitForApplicationLaunch()
test.py

Then the waitForApplicationLaunch() command should be replaced with these lines:

waitFor('currentApplicationContext().name == "_webhook"', 10000)
    snooze(1)

So the modified script should look like this:

import names
def main():
    startApplication("eclipse")
    clickButton(waitForObject(names.Workspace_Launcher_OK_Button))
    activateItem(waitForObjectItem(names.Eclipse_Menu, "Help"))
    activateItem(waitForObjectItem(names.Help_Menu, "Help Contents"))

    waitFor('currentApplicationContext().name == "_webhook"', 10000)
    test.breakpoint()
test.py

Step #2: Use Squish | Record Snippet

For this do the following:

The resulting script should look similar to this:

import names
def main():
    startApplication("eclipse")
    clickButton(waitForObject(names.Workspace_Launcher_OK_Button))
    activateItem(waitForObjectItem(names.Eclipse_Menu, "Help"))
    activateItem(waitForObjectItem(names.Help_Menu, "Help Contents"))

    waitFor('currentApplicationContext().name == "_webhook"', 10000)
    waitForContextExists(names.index.jsp.FRAME2.FRAME1.FRAME1.FRAME1.FRAME2)
    mouseClick(waitForObject(names.Expand_topics_IMG), 1, 2)
    clickLink(waitForObject(names.Workbench_User_Guide_A))
    clickLink(waitForObject(names.Eclipse_platform_overview_A))
    clickLink(waitForObject(names.Getting_started_A))
    clickLink(waitForObject(names.Concepts_A))
    clickLink(waitForObject(names.Tasks_A))
    clickLink(waitForObject(names.Reference_A))
    clickLink(waitForObject(names.Tips_and_tricks_A))
    clickLink(waitForObject(names.Whats_new_A))
    clickLink(waitForObject(names.Legal_A))
    clickLink(waitForObject(names.Workbench_User Guide_A))
test.py