[code:2cx4c2b8]package com.soapuitutorial.propertie;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class SendGMail {
public static WebDriver driver;
public static void main(String[] args) throws InterruptedException
{
driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://gmail.com/");
driver.manage().window().maximize();
Actions act= new Actions(driver);
//logging into gmail and opening the inbox
driver.findElement(By.xpath("//*[@id='Email']")).sendKeys("qtpselenium.supp0rt@gmail.com");
driver.findElement(By.xpath("//*[@id='next']")).click();
driver.findElement(By.xpath("//*[@id='Passwd']")).sendKeys("m0b1l390n3"); //password hided intensionally
driver.findElement(By.xpath("//*[@id='signIn']")).click();
//click on compose button
driver.findElement(By.xpath("//div[text()='COMPOSE']")).click();
//entering the subject
WebElement subject=driver.findElement(By.xpath("//table//tr//td//div//input[@placeholder='Subject']"));
subject.sendKeys("testmail");
// entering the tolist
WebElement tolist=driver.findElement(By.xpath("//table//tr//td//div//input[@placeholder='Subject']//../preceding-sibling::div[1]/div"));
act.moveToElement(tolist).clickAndHold(tolist);
Thread.sleep(5000);
act.release(tolist);
tolist.sendKeys("sindhura0101@gmail.com");
driver.close();
}
}
[/code:2cx4c2b8]
Hi Ashish
Inbox --unable to print in toloist box
Thank you for all of your responses for my questions.
The xpath you used here are so weird.How can I identify and learn more about this xpath and xpath Axes.
Do you have any documentation or any suggested tutorials on Xpath Axes.
I have seen Xpath Axes but bit confusing to move back and forth using following-sibling,preceding-sibiling to descendant to childs.
why are you using // overall here
what is the meaning of 0L when initializing to long.eg int height=0L;
Thank you.
why do you want to automate gmail?
Google products are one of the most difficult websites to automate.