下面的代码是基于 TestMore 0.6D301 编写的用于测试 Google 搜索主页的 Python 语言自动化案例,该案例只是简单的在关键字输入框中输入 TestMore ,然后点击搜索按钮搜索,然后在查询结果页中点击 TestMore 链接;
################################################################################
# Case Name: Test Case Template
# Description: Test case template for python
# Update History:
# - 2007-11-02 Andy.Tao Create test case template(Python version)
# -
################################################################################
import sys
import clr
clr.AddReferenceByName("IEProvider")
from ZuHong.Automation.IEProvider import *
ie = IEProcess()
ie.Wait(5000)
ie.MainWindow.Open("http://www.google.com/webhp?hl=en-US")
window = ie.MainWindow
window.Options.PageLoadTimeOut = 300
window.Sync()
#Setup query parameters
page = ie.MainWindow.Page
page.Select("name=q").Text = "TestMore"
page.Select("name=btnG").Click()
window.Sync()
#Select site
page.SelectArray("href=/http://code.google.com/p/testmore/")[0].Click();
window.Sync()
# Case Name: Test Case Template
# Description: Test case template for python
# Update History:
# - 2007-11-02 Andy.Tao Create test case template(Python version)
# -
################################################################################
import sys
import clr
clr.AddReferenceByName("IEProvider")
from ZuHong.Automation.IEProvider import *
ie = IEProcess()
ie.Wait(5000)
ie.MainWindow.Open("http://www.google.com/webhp?hl=en-US")
window = ie.MainWindow
window.Options.PageLoadTimeOut = 300
window.Sync()
#Setup query parameters
page = ie.MainWindow.Page
page.Select("name=q").Text = "TestMore"
page.Select("name=btnG").Click()
window.Sync()
#Select site
page.SelectArray("href=/http://code.google.com/p/testmore/")[0].Click();
window.Sync()