圖片發(fā)自簡(jiǎn)書(shū)App
public static void checkText(Android driver鞠眉,String bytype,String object,String data,String check){
Thread.sleep(500);
try{
//獲取指定元素文本信息
String a=driver.findElement(by(by type,object)).getText();
System.out.println("實(shí)際運(yùn)行的值"+a);
if(a.equals(checkvalue){
//如果獲取到的文本信息和參數(shù)傳過(guò)來(lái)的信息相符),就斷言成功样漆,設(shè)置為true
constant.sTestResult=true;}
else{
//斷言失敗為false
constant.sTestResult=false;}
}catch(Exception e){
e.printStackTrace();
//如果獲取元素時(shí)報(bào)錯(cuò)設(shè)為false
constant.sTestResult=false;
}
}