-2
使用Selenium驗證只讀屬性。使用Selenium的只讀屬性
.getAttribute("readonly")
返回「真」,如果它是隻讀對象,並返回「空」,如果它不是一個只讀對象
如何來處理呢?這裏有需要的任何try catch嗎?
String State = driver.findElement(By.id("Organisationname")).getAttribute("readonly");
這個返回「true」如果文本框是隻讀的,「空」,如果它是不是隻讀 我想下面的if else condition.But而移動到else語句的InvocationTargetException快到了
難道監守返回類型真實的和無效
if(State .contains("true")){
System.out.println("readonly");
}else{
System.out.println("not readonly");
}
你想完成什麼?請仔細閱讀[問]。 – SiKing 2015-02-10 15:58:33
String State = driver.findElement(By.id(「Organisationname」))。getAttribute(「readonly」);這將返回「真」,如果文本框是隻讀的,「空」,如果它是不是隻讀 \t \t如果(國家。載有(「真」)){ \t \t的System.out.println(「只讀」); \t} else { \t \t System.out.println(「not readonly」); \t} – Ganesh 2015-02-11 05:35:16