Friday 24 April 2015

Script for logging into gmail and logout.

package WebdriverDemo2;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class WebDriverDemo2 {

public static void main(String[] args) throws InterruptedException {
WebDriver driver= new FirefoxDriver();
driver.get("http://www.gmail.com");
driver.findElement(By.id("Email")).sendKeys("manju.naidu13@gmail.com");
driver.findElement(By.id("Passwd")).sendKeys("***********");
driver.findElement(By.id("signIn")).click();
Thread.sleep(40000);
driver.findElement(By.xpath("//div[@id='gb']/div/div/div/div[2]/following-sibling::div/div/a/span")).click();
Thread.sleep(600);
driver.findElement(By.xpath("//a[contains(text(),'Sign out')]")).click();
System.out.println("Login---> Logout Pass!!");

}

}

1 comment:

  1. If you ever want to change or up your university grades contact cybergolden hacker he'll get it done and show a proof of work done before payment. He's efficient, reliable and affordable. He can also perform all sorts of hacks including text, whatsapp, password decrypt,hack any mobile phone, Escape Bancruptcy, Delete Criminal Records and the rest

    Email: cybergoldenhacker at gmail dot com

    ReplyDelete