Synchro failures are the most common reasons why UI tests give us false positives. I'd like to show you the result of my team's work, which will help you to improve the stability & reliability of your UI tests.

UI Driver can be easily implemented in every project using Selenium WebDriver with Java bindings as it is going to be released as an open source project soon. This library contains classes / interfaces, such as extension of WebDriver (for those who think that the base set of WebDriver methods is not enough), and its implementation. I will show you the usage and benefits of SearchContext and new features like ContextExpectedConditions and IncrementalWait.

2 favorite thumb_down thumb_up 2 comments visibility_off  Remove from Watchlist visibility  Add to Watchlist

Outline/structure of the Session

  • show what is ui-driver
  • explain its benefits
  • show advanced usage of SearchContext
  • talk about future (open source, mobile)

Learning Outcome

  • different way how to handle synchronization
  • understand benefits of SearchContext

Target Audience

Automation engineers will get most of it

schedule Submitted 2 years ago

Comments Subscribe to Comments

comment Comment on this Proposal
  • Dave Haeffner Test
    By Dave Haeffner Test  ~  1 year ago
    reply Reply

    How does ui-driver address the synchronization issues? Can you please provide more information about this?

    • AndrejS
      By AndrejS  ~  1 year ago
      reply Reply

      it's build on explicit waits, but improved. It works with SearchContext (much faster xpath evaluation in Chrome when searchin in Context and not in whole DOM). Lets take example that we want to click Cancel button in Confirmation popup (which is displayed on top of some other page where is another Cancel button). With UI-driver you can easily click this button by this command: popup instance, By.xpath("./descendant::button[text()='Cancel']"), 5000);

      This will first locate popup, then search for button inside of this popup (so it will not find other Cancel button), then it will click. And if you run this 1 million times, you will definitely get some exceptions like StaleElement which might occur after findElement return you button (or popup) and actual click action. Implementation of these methods can handle every known synchro issue. If this method is not completed in timeout (5s), then method will fail. Here's example how some methods are implemented:

      public WebElement assertDisplayed(By by) {
      return assertDisplayed(driver, by, Timeout.getCommandTimeout());
      public WebElement assertDisplayed(final SearchContext context, final By by, final long timeoutMs) {
      IncrementalWait wait = new IncrementalWait<>(context, timeoutMs, 5);
      try {
      return wait.until(ContextExpectedConditions.visibilityOfElementLocated(this, by));
      } catch (TimeoutException ex) {
      throw new ElementNotVisibleException(String.format("Element located\n%s\nis not displayed after timeout (%d ms) in the search context:\n%s", by.toString(), timeoutMs, getContextInfo(context)));

      public void sendKeys(SearchContext context, By by, long timeoutMs, CharSequence... keysToSend) {
      sendKeysToSatisfyCondition(context, by, new Predicate() {
      public boolean apply(@Nullable SearchContext searchContext) {
      return true;

      public String toString() {
      return "Without condition.";
      }, 3000, timeoutMs, keysToSend);