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:

def main():
    startApplication("eclipse")
    clickButton(waitForObject(":Workspace Launcher.OK_Button"))
    activateItem(waitForObjectItem(":* - Eclipse_Menu", "Help"))
    activateItem(waitForObjectItem(":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:

def main():
    startApplication("eclipse")
    clickButton(waitForObject(":Workspace Launcher.OK_Button"))
    activateItem(waitForObjectItem(":* - Eclipse_Menu", "Help"))
    activateItem(waitForObjectItem(":Help_Menu", "Help Contents"))

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

Step #2: Use Squish | Record Snippet

For this do the following:

The resulting script should look similar to this:

def main():
    startApplication("eclipse")
    clickButton(waitForObject(":Workspace Launcher.OK_Button"))
    activateItem(waitForObjectItem(":* - Eclipse_Menu", "Help"))
    activateItem(waitForObjectItem(":Help_Menu", "Help Contents"))

    waitFor('currentApplicationContext().name == "_webhook"', 10000)
    waitForContextExists(":index.jsp.FRAME2.FRAME1.FRAME1.FRAME1.FRAME2")
    mouseClick(waitForObject(":Expand topics_IMG"), 1, 2)
    clickLink(waitForObject(":Workbench User Guide_A"))
    clickLink(waitForObject(":Eclipse platform overview_A"))
    clickLink(waitForObject(":Getting started_A"))
    clickLink(waitForObject(":Concepts_A"))
    clickLink(waitForObject(":Tasks_A"))
    clickLink(waitForObject(":Reference_A"))
    clickLink(waitForObject(":Tips and tricks_A"))
    clickLink(waitForObject(":What's new_A"))
    clickLink(waitForObject(":Legal_A"))
    clickLink(waitForObject(":Workbench User Guide_A"))
test.py