|
本帖最后由 wonder2004 于 2011-7-23 13:41 编辑
写了个简单的脚本,就是访问baidu首页,输入检索内容,点击按钮。但是回放时报错,root为空。为什么?
PS:在configure---->enable environments for testing---->web browsers 中test是 ok
脚本如下:
public class TestBaidu extends TestBaiduHelper
{
public void testMain(Object[] args)
{
startBrowser("http://www.baidu.com/");
sleep(3);
RootTestObject root = RootTestObject.getRootTestObject();
TestObject texts=root.find(SubitemFactory.atDescendant("id", "kd", "name", "wd"));
TextGuiTestObject Text = (TextGuiTestObject)Login[0];
Text.setText("a");
TestObject[] Buttons = root.find(SubitemFactory.atDescendant("type", "submit", "id", "su"));
GuiTestObject Button=(GuiTestObject)Buttons[0];
Button.click();
}
} |
|