0

While writing automated tests using GEB framework, may I use the Webdriver API's directly? For example, some thing like as below:

WebElmenent element=driver.findElement(By.xpath("//input..."))
WebElement myDynamicElement = (new WebDriverWait(driver, 10))
  .until(ExpectedConditions.visibilityOf(element));

Is it possible to use the WebDriver API's directly as above?

Thanks,

Raghuveer.

2 Answers2

0
 public static void waitForElementToAppear(Driver driver, By selector, long timeOutInSeconds, String timeOutMessage) {
    try {
      WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
      wait.until(ExpectedConditions.visibilityOfElementLocated(selector));
    } catch (TimeoutException e) {
      throw new IllegalStateException(timeOutMessage);
    }
  }
Ran Adler
  • 3,587
  • 30
  • 27
0

While Geb does allow you to access Webdriver apis directly, it does not support xpath, which is generally considered a good thing. Geb's css selectors are one of it's strengths and should allow you to do anything you'd like to do with xpath. If you're familiar at all with css and/or jQuery, the time to learn Geb's syntax should be relatively brief.

Brine
  • 3,733
  • 1
  • 21
  • 38