嵌入在Java应用程序(Eclipse)中的自动化Internet Explorer

最后编辑了

概述

自动嵌入在Java应用程序中的Internet Explorer(例如Eclipse的帮助查看器),需要以下内容:

添加到可信站点

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.

要执行此操作,请在Quish之外启动Internet Explorer,然后执行以下操作:

可选,替代录制方法

通常不需要以下步骤,但在完整测试用例的直接记录不会产生Internet Explorer自动化的命令的情况下可能有用。

录制必须分为两个步骤:

步骤1: 录制直到嵌入式Internet Explorer是可见的,然后结束录制。

生成的脚本应该看起来类似:

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.

然后应该用这些行替换WaitForapplicationLaunch()命令:

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

所以修改后的脚本应该如下所示:

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.

第2步: Use squ | Record Snippet

为此,请执行以下操作:

生成的脚本应该看起来类似:

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.