Created
March 11, 2011 23:15
-
-
Save santiycr/866785 to your computer and use it in GitHub Desktop.
Tweet about #SeleniumConf!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openqa.selenium.*; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import java.util.concurrent.TimeUnit; | |
public class Tweet { | |
public static void goTweet() throws Exception { | |
WebDriver driver = new FirefoxDriver(); | |
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); | |
driver.get("http://twitter.com"); | |
driver.findElement(By.id("username")).sendKeys("<user>"); | |
driver.findElement(By.id("password")).sendKeys("<pass>"); | |
driver.findElement(By.id("signin_submit")).submit(); | |
driver.findElement(By.xpath("//textarea")).sendKeys("#SeleniumConf is awesome!"); | |
driver.findElement(By.linkText("Tweet")).click(); | |
driver.close(); | |
} | |
public static void main(String[] args) throws Exception { | |
goTweet(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment