Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.htmlunit.HtmlUnitDriver;
- import org.openqa.selenium.phantomjs.PhantomJSDriver;
- import org.openqa.selenium.remote.DesiredCapabilities;
- public class testing {
- public static void main(String[] args) throws InterruptedException {
- System.setProperty("phantomjs.binary.path", "../Third Party Libraries/phantomjs-1.9.2-windows/phantomjs.exe");
- DesiredCapabilities dCaps;
- dCaps = new DesiredCapabilities();
- dCaps.setJavascriptEnabled(true);
- dCaps.setCapability("takesScreenshot", false);
- WebDriver driver = new PhantomJSDriver(dCaps);
- System.out.println("Page title is: " + driver.getTitle());
- driver.get("http://www.twitch.tv/login");
- System.out.println("Page title is: " + driver.getTitle());
- WebElement element = driver.findElement(By.id("login_user_login"));
- element.sendKeys("username");
- WebElement element2 = driver.findElement(By.id("user[password]"));
- element2.sendKeys("password");
- element2.submit();Thread.sleep(3000);
- System.out.println("Page title is: " + driver.getTitle());Thread.sleep(3000);
- driver.get("http://www.twitch.tv/mradder89/profile/following");Thread.sleep(3000);
- driver.findElement(By.xpath("//span[@id='ember637']/a/span")).click();
- System.out.println("Page title is: " + driver.getTitle());
- System.out.println("done");
- driver.quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement