phoenixframework自動化平臺關於定位資訊入庫與不入庫的示例
阿新 • • 發佈:2019-02-11
package org.phoenix.cases; import java.util.LinkedList; import org.phoenix.action.WebElementActionProxy; import org.phoenix.enums.LocatorType; import org.phoenix.model.CaseLogBean; import org.phoenix.model.UnitLogBean; /** * 使用本地資料作引數化 * @author mengfeiyang * */ public class TestPhoenixCaseUseData extends WebElementActionProxy{ private static String caseName = "IE"; public TestPhoenixCaseUseData() { } @Override public LinkedList run(CaseLogBean caseLogBean) { init(caseName,caseLogBean); webProxy.openNewWindowByIE("http://www.baidu.com"); webProxy.webElement("setval").setText("1"); String s = webProxy.webElement("clickbutton").getAttrValue("value"); System.out.println(s); //如果校驗結果返回null,表示驗證通過 webProxy.checkPoint().checkIsEqual("百度一下", s); //直接使用定位資料方式,如果定位資訊是id和class,則LocatorType可以為null或者寫css,如: //webProxy.webElement("#su", null).click();//此句與下句的執行效果是一樣的 //webProxy.webElement("#su", LocatorType.CSS).click(); //使用資料庫中的資料的方式。這種方式無需再指定定位型別,但在填寫定位資訊時無需指定識別符號,比如, //如果id是:#su,則錄入時錄su即可。但資料型別需要選擇為:ID。 webProxy.webElement("clickbutton").click(); webProxy.checkPoint().checkIsFalse(s!=null); webProxy.sleep(100); webProxy.closeWindow(); return getUnitLog(); } public static void main(String[] args) { TestPhoenixCaseUseData t = new TestPhoenixCaseUseData(); LinkedList ll = t.run(new CaseLogBean()); for(UnitLogBean l : ll){ System.out.println(l.getContent()); } } }