我目前没有找到相关的API,要么就用selenium1中的对象,但我不想那样做,先出了下面的方法:
WebDriver will throw NoSuchElementException if the object is not
found. I have wrapped that logic in a function to check if the element
exists
public boolean doesWebElementExist(WebDriver driver, By selector) {
try {
driver.findElement(selector);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
要是谁知道先关的API方法,还请告诉我下,谢谢!