类型API作用
窗口selectWindow选择一个弹出窗selectWindow("null")返回主窗体
waitForPopUp等待出现
close关闭子窗口
页面 selenium.open打开网页
waitForPageToLoad等待页面
输入、
输出click点击按钮
type文 本 框
getValue文 本 框
select下拉列表
复选单选
boolean
isEditable(https://www.wendangku.net/doc/504744919.html,ng.S tring locator)判断某文本框是否可编辑
对话框isAlertPresent处理弹出对话框js语法waitForCondition等待获取js的值
eg使用场景selenium.selectWindow("搜索产品");
selenium.selectWindow("null");
selenium .waitForPopUp("myPopupWindow", "30000");等待出现selenium .close();关闭子窗口 selenium.open("https://www.wendangku.net/doc/504744919.html,/");
selenium.waitForPageToLoad("20000");使用场景如:
selenium.click("buttonorlink");当点击了按钮后调用该方法,等待新页面的打开
selenium.click("css=input[type=button]");
selenium.type("name", "cxr1217");输入
selenium.getValue("name");得到selenium.select("cities", "label=hebei");选中选项selenium.getSelectOptions("cities");得到选项selenium.check("radioname");选中selenium.isChecked("radioname");判断是否选中selenium.isEditable("xpath=//input@name='addProfil
eLastName'");
if(selenium.isAlertPresent()) { selenium.getAlert(); }获得当前的alert窗口的值,获得后该窗口即被关闭
selenium.waitForCondition("var msg =
selenium.getAlert();msg.match(\""+msg+"\")","10000 ");使用该方法在大部分场景上可以代替waitForPageToLoad("20000");
从而避免 等待时长不确定问题