/** * Waits until the specified JavaScript returns a non-false value. * * @param expression the JavaScript expression to evaluate * @param timeout time in seconds to wait until a TimeoutException is thrown * @throws TimeoutException */ public void evaluatedJavaScriptExpression(String expression, int timeout) throws TimeoutException { WebDriverWait wait = new WebDriverWait(browser.getWebDriver(), timeout); // start waiting for adequate evaluation of expression wait.until(new JavaScriptEvaluatedWaitCondition(browser, expression)); }
/** * Waits until element contains the specified text. Useful for waiting for an AJAX call to * complete. * * @param element the element to observe * @param text when the element contains this text the execution of the program will be continued * @throws TimeoutException */ public void elementText(HtmlElement element, String text) throws TimeoutException { FluentWait<WebDriver> wait = new FluentWait<WebDriver>(browser.getWebDriver()) .withTimeout(timeout, TimeUnit.SECONDS) .pollingEvery(500, TimeUnit.MILLISECONDS); // start waiting for given text of element wait.until(new ElementHasTextWaitCondition(element, text)); }
/** * Waits until element is found. Useful for waiting for an AJAX call to complete. * * @param query the element query * @throws TimeoutException */ public void query(HtmlQuery query) throws TimeoutException { // WebDriverWait wait = new WebDriverWait(browser.getWebDriver(), timeout); FluentWait<WebDriver> wait = new FluentWait<WebDriver>(browser.getWebDriver()) .withTimeout(timeout, TimeUnit.SECONDS) .pollingEvery(1, TimeUnit.SECONDS); // start waiting for given element wait.until(new ElementWaitCondition(query)); }
@Override protected void parseTitle() { title = browser.getWebDriver().getTitle(); // browser.log().debug(" TITLE: " + content.getTitle()); }
public HtmlParser(Browser browser) { super(browser.getWebDriver().getPageSource()); this.browser = browser; }