问题
In my web page, when I click OK button, some HTML tag will be added in current page source for display popup (the URL is not changed).
How can I get new web element from current page?
回答1:
You can use explicit wait to wait for the element to be added to the DOM
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("newElementId")));
来源:https://stackoverflow.com/questions/54214334/reload-dom-element-in-selenium-webdriver-after-some-new-tag-added