Sei sulla pagina 1di 2

package automation;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
//import org.openqa.selenium.WebElement;
//import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
//import org.openqa.selenium.interactions.Action;
//import org.openqa.selenium.interactions.Actions;
//import org.openqa.selenium.ie.InternetExplorerDriver;
public class demo {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
WebDriver driv=new FirefoxDriver();
driv.get("http://www.google.com");
driv.findElement(By.linkText("Gmail")).click();
driv.findElement(By.id("Email" )).sendKeys("techno.anitha");
driv.findElement(By.id("Passwd" )).sendKeys("9600268548");
boolean user=driv.findElement(By.id("signIn")).isDisplayed();
if(user)
{
System.out.println("Logged successfully");
}else
{
System.out.println("Logged not successfully");
}
driv.findElement(By.id("signIn")).click();
Thread.sleep(10000);
//driv.findElement(By.xpath("/html/body/div[11]/div[2]/div/div[2
]/div/div/div/div[2]/div/div/div/div/div")).click();
driv.findElement(By.xpath("//div[text()='COMPOSE']")).click();
driv.findElement(By.xpath("//textarea[@class='vO']")).sendKeys("
techno.anitha@gmail.com");
driv.findElement(By.xpath("//input[@class='aoT']")).sendKeys("te
stmail");
WebElement ifr = driv.findElement(By.xpath("//iframe[@tabindex='
1']"));
driv.switchTo().frame(ifr);
driv.findElement(By.xpath("//*[@class='editable LW-avf']")).send
Keys("hi");
String parent = driv.getWindowHandle();
driv.switchTo().window(parent);
//driv.findElement(By.xpath("//div[@class='T-I J-J5-Ji aoO T-I-atl L3']"
)).click();
driv.findElement(By.linkText("Send")).click();
Thread.sleep(10000);
//driv.findElement(By.xpath("//input[@class='gbqfif']")).sendKeys("citib
ank offers");
//Thread.sleep(10000);
//driv.findElement(By.xpath("//button[@class='gbqfb gbqfb-hvr']")).click
();
//WebElement web=driv.findElement(By.className("gbqfb"));
// web.click();

// Actions actions=new Actions(driv);


//actions.moveToElement(web).build().perform();
//driv.findElement(By.xpath("//*[@id='gbqfb']")).click();
driv.findElement(By.xpath("//span[@id='gbgs4dn']")).click();
driv.findElement(By.xpath("//*[@id='gb_71']")).click();
driv.close();
}
}

Potrebbero piacerti anche