我試圖測試ROUND TRIP是否被選中。我可以看到ROUND TRIP被選中,但我仍然得到輸出爲false爲什麼?isSelected()方法在硒代碼中返回false
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class IsSelected {
public static void main(String[] args) {
WebDriver f= new FirefoxDriver();
f.get("http://www.makemytrip.com/");
WebElement e = f.findElement(By.id("round_trip_button1"));
System.out.println(e.isSelected());
System.out.println(e.getText());
System.out.println(e.isDisplayed());
System.out.println(e.isEnabled());
}
}
仍然顯示相同的假 – 2015-03-02 09:01:21
@amolsaxena請參閱更新。 – alecxe 2015-03-02 14:18:00