我想與硒webdriver同步和東西不隱式地處理()。與implicitwait同步()不起作用,爲什麼?
我明白implicitlyWait(..)的方式是,代碼是等待直到元素是可用於最大的時間。
下面崩潰的代碼與錯誤:
org.openqa.selenium.InvalidElementStateException: invalid element state: Element is not currently interactable and may not be manipulated
的System.out的IST印刷: - >>假真假(isDiplayed()的IsEnabled(),選擇())
private static WebDriver driver;
public static void main(String[] args) throws InterruptedException {
setupWebDriverChrome();
//Thread.sleep(1000);
final String cssSelectorFromAirport = "div.od-airportselector.airportselector_root input[tabindex='11']";
final By cssSelector = By.cssSelector(cssSelectorFromAirport);
WebElement fromAirportElement = driver.findElement(cssSelector);
System.out.println("-->> " + fromAirportElement.isDisplayed() + " " + fromAirportElement.isEnabled() + " " + fromAirportElement.isSelected());
fromAirportElement.clear();
fromAirportElement.sendKeys("MUC");
}
private static void setupWebDriverChrome() {
System.setProperty("webdriver.chrome.driver", "C:\\...\\chromedriver.exe");
setupLocation();
}
private static void setupLocation() {
driver.manage().timeouts().implicitlyWait(1000, TimeUnit.MILLISECONDS);
driver.get("https://www.opodo.de/");
}
我試過這也與Geckodriver具有相同的結果。
我也增加了等待時間,但同樣的結果。
,使其工作的唯一辦法,就是使用了Thread.sleep()(以上評論)
編輯 PLS。請注意,我沒有看到與Selenium implicitwait not working重複。
@ Janith1024我所見過的線程侑意思,但我沒有看到任何重複。如果你的意思是有重複請求。解釋爲什麼 – ken