您的位置:首页 > 运维架构 > Linux

Linux系列-Red Hat5平台下的DNS服务搭建

2010-03-17 11:57 781 查看
在java类中使用selenium进行web测试的一些基本操作如下所示:

1、打开网页: selenium.open("http://www.xxx.com.cn/");// 使用open时候,不需进行 waitForPageToLoad 调用

2、等待页面: selenium.waitForPageToLoad("20000"); 使用场景如:selenium.click("buttonorlink"); 当点击了按钮后调用该方法,等待页面的打开

3、点击按钮: selenium.click("css=input[type=button]");

4、文 本 框: selenium.type("name", "cxr1217"); 输入
                  selenium.getValue("name"); 得到

5、下拉列表: selenium.select("cities", "label=hebei"); 选中选项
                  selenium.getSelectOptions("cities"); 得到所有选项

6、复选单选: selenium.check("radioname"); 选中

                  selenium.isChecked("radioname");是否选中

7、关闭alert对话框: if(selenium.isAlertPresent()) {
                                 selenium.getAlert(); //获得当前的alert窗口的值,获得后该窗口即被关闭 
                           }

8、选中子窗口: selenium .waitForPopUp("myPopupWindow", "30000");等待出现
                     selenium .selectWindow("name=myPopupWindow"); 选中子窗口
                     selenium .close(); 关闭子窗口.                 
                     selenium .selectWindow(null); 退回主窗口.

9、selenium.waitForCondition("var msg = selenium.getAlert();msg.match(\""+msg+"\")","10000");
这个waitForCondition("javascript","timeout")方法是目前为止我最喜欢的,可以使用js语法运行,在规定时间内 “timeout”,直到获取该js的值,返回。使用该方法在大部分场景上可以代替 waitForPageToLoad("20000");

从而避免 等待时长不确定问题

 

 

随着selenium的使用深入,会不断添加……
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: