title: Problems with some Automation Testing using Before / After / Test
body: <p>Problems with some Automation Testing using Before / After / Test
      I'm getting stuck at the browser window, no test is executed...
  Not sure why this doesn't work. I've exported some tests from Selenium IDE, exported as Java, edited that stuff in Eclipse, yet still it doesn't work...</p>
  
  <pre><code>import java.util.regex.Pattern;
  import java.util.concurrent.TimeUnit;
  import org.junit.*;
  import static org.junit.Assert.*;
  import static org.hamcrest.CoreMatchers.*;
  import org.openqa.selenium.*;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.openqa.selenium.support.ui.Select;
  
  public class Checkimage {
    private WebDriver driver;
    private String baseUrl;
    private boolean acceptNextAlert = true;
    private StringBuffer verificationErrors = new StringBuffer();
  
    @Before
    public void setUp() throws Exception {
      driver = new FirefoxDriver();
      baseUrl = "http://";
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }
  
    @Test
    public void testCheckimage() throws Exception {
      driver.get("http://");
      for (int second = 0;; second++) {
          if (second &gt;= 60) fail("timeout");
          try { if (isElementPresent(By.linkText("sign in / up"))) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  
      driver.findElement(By.id("login-email")).clear();
      driver.findElement(By.id("login-email")).sendKeys("michael.sinitsin@avid.com");
      driver.findElement(By.id("login-password")).clear();
      driver.findElement(By.id("login-password")).sendKeys("mike1780");
      for (int second = 0;; second++) {
          if (second &gt;= 60) fail("timeout");
          try { if ("sign in".equals(driver.findElement(By.id("login-buttons-password")).getText())) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  
      driver.findElement(By.id("login-buttons-password")).click();
      for (int second = 0;; second++) {
          if (second &gt;= 60) fail("timeout");
          try { if ("Tester".equals(driver.findElement(By.linkText("Tester")).getText())) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  
      driver.findElement(By.linkText("Tester")).click();
      for (int second = 0;; second++) {
          if (second &gt;= 60) fail("timeout");
          try { if (isElementPresent(By.id("inputScoreUrl"))) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  
      driver.findElement(By.id("inputScoreUrl")).sendKeys("http://www.sheetmusicdirect.com/scorches/smd_000001.sco");
      for (int second = 0;; second++) {
          if (second &gt;= 60) fail("timeout");
          try { if ("Enter a URL to a publicly accessible SCO file. No need to URL encode it, just copy and paste it in.".equals(driver.findElement(By.cssSelector("p.help-block")).getText())) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  
      driver.findElement(By.id("submitScoreView")).click();
      for (int second = 0;; second++) {
          if (second &gt;= 60) fail("timeout");
          try { if (isElementPresent(By.cssSelector("img"))) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  
      try {
        assertTrue(isElementPresent(By.cssSelector("img")));
      } catch (Error e) {
        verificationErrors.append(e.toString());
      }
    }
  
    @After
    public void tearDown() throws Exception {
      driver.quit();
      String verificationErrorString = verificationErrors.toString();
      if (!"".equals(verificationErrorString)) {
        fail(verificationErrorString);
      }
    }
  
    private boolean isElementPresent(By by) {
      try {
        driver.findElement(by);
        return true;
      } catch (NoSuchElementException e) {
        return false;
      }
    }
  
    private boolean isAlertPresent() {
      try {
        driver.switchTo().alert();
        return true;
      } catch (NoAlertPresentException e) {
        return false;
      }
    }
  
    private String closeAlertAndGetItsText() {
      try {
        Alert alert = driver.switchTo().alert();
        String alertText = alert.getText();
        if (acceptNextAlert) {
          alert.accept();
        } else {
          alert.dismiss();
        }
        return alertText;
      } finally {
        acceptNextAlert = true;
  </code></pre>
  
  <p>Not sure why this doesn't work. I've exported some tests from Selenium IDE, exported as Java, edited that stuff in Eclipse, yet still it doesn't work...</p>