Skip to content

Instantly share code, notes, and snippets.

Created July 20, 2011 19:18
Show Gist options
  • Select an option

  • Save anonymous/1095693 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/1095693 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jul 20, 2011.
    27 changes: 27 additions & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    import org.openqa.selenium.By;
    import org.openqa.selenium.NoSuchElementException;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class FFLinux {
    public static void main(String[] args) {
    WebDriver ff = new FirefoxDriver();
    ff.get("http://www.domain.com");
    ff.findElement(By.linkText("Login")).click();
    ff.findElement(By.xpath("//div[@id = 'idSignIn']")).click();
    ff.findElement(By.id("logonId")).sendKeys("user");
    ff.findElement(By.id("logonPassword")).sendKeys("pass");
    ff.findElement(By.id("Sign_In_and_Continue")).click();
    try {
    ff.findElement(By.id("search_field"));
    System.out.println("Search field found");
    }
    catch (NoSuchElementException e) {
    System.out.println("Search field not found");
    ff.quit();
    }
    finally {
    ff.quit();
    }
    }
    }