title: Testing GWT app using Selenium 2
body: <p>I'm trying to test a button click using Selenium.
  My first page has a button with ID = HOME_START_BUTTON.
  When I click this my app then goes to a page with a button with an ID = CONTACTS_ADD_BUTTON.
  Here is the code I have to test this.</p>
  
  <pre><code>private static boolean checkPageContainsStartButton()
  {
      // type search query
      // driver.findElement(By.name("q")).sendKeys("qa automation\n");
  
      //Use static finals for these button names
      WebElement startButton = driver.findElement(By.id("HOME_START_BTN"));
      if (startButton == null)
      {
          return false;
      }
      else
      {
          startButton.click();
      }
  
      WebElement myDynamicElement = (new WebDriverWait(driver, 30))
        .until(new ExpectedCondition&lt;WebElement&gt;(){
              @Override
              public WebElement apply(WebDriver d) {
              return d.findElement(By.id("CONTACTS_ADD_BTN"));
      }});
  
      WebElement addButton = driver.findElement(By.id("CONTACTS_ADD_BTN"));
  }
  </code></pre>
  
  <p>Error stack trace </p>
  
  <pre><code>Command duration or timeout: 28 milliseconds
  For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
  Build info: version: '2.29.0', revision: '58258c3', time: '2013-01-17 22:47:00'
  System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_04'
  Session ID: b25e7efb428c98da880826fbf9e68de6
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities [{platform=XP, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=24.0.1312.57, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:302)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:331)
      at org.openqa.selenium.By$ById.findElement(By.java:216)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:294)
      at WebDriverTestClass.checkPageContainsStartButton(WebDriverTestClass.java:67)
      at WebDriverTestClass.main(WebDriverTestClass.java:35)
  Test failed.
  </code></pre>
  
  <p>My test passes if I comment out </p>
  
  <pre><code>WebElement addButton = driver.findElement(By.id("CONTACTS_ADD_BTN"));
  </code></pre>
  
  <p>So basically Selenium does not appear to be able to see the new widgets on the browser window when I do a button click</p>