Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Regarding Alert Interface
Fri Feb 24, 2017 2:00 pm by karthikeyakumar

» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

automate gmail to sent email using webdriver

View previous topic View next topic Go down

automate gmail to sent email using webdriver

Post by soumyacr88 on Wed Jun 05, 2013 12:03 pm

Hi,

Can someone please help me to automate sending email in Gmail.

I am not able to add "to Address" .

Please find my code below
WebElement name=driver.findElement(By.name("Email"));
name.click();
name.sendKeys("email");
WebElement password=driver.findElement(By.id("Passwd"));
password.click();
password.sendKeys("Password");
WebElement Signin=driver.findElement(By.id("signIn"));
Signin.click();

driver.switchTo().frame("canvas_frame");
WebDriverWait mywait=new WebDriverWait(driver, 30);
mywait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".aic .z0")));

WebElement compose=driver.findElement(By.cssSelector("div[class='T-I J-J5-Ji T-I-KE L3']"));
compose.click();
System.out.println("compose Clicked");
WebElement ToAdd=driver.findElement(By.className(".vO"));
ToAdd.clear();
ToAdd.click();
ToAdd.sendKeys("Toaddress");

soumyacr88

Posts : 1
Join date : 2013-06-04

Back to top Go down

Re: automate gmail to sent email using webdriver

Post by tarun3kumar on Wed Jun 05, 2013 1:11 pm

asked and answered many times. Don't try to automate Gmail using Selenium.
Rather user mail API available in programming language of your choice to carry out mail activity.

_________________
Thanks
Tarun K
Free Selenium Training

tarun3kumar
Master
Master

Posts : 186
Join date : 2012-02-14

http://seleniumtests.com

Back to top Go down

Sending Email from Gmail..

Post by sree.cs10@gmail.com on Tue Jun 18, 2013 12:16 am

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;

public class SendEmailFromGmail {
public static void main(String[] args) throws Exception {
WebDriver fd=new FirefoxDriver();
fd.get("http://www.gmail.com");
fd.findElement(By.id("Email")).click();
fd.findElement(By.id("Email")).sendKeys("username@gmail.com");
fd.findElement(By.id("Passwd")).click();
fd.findElement(By.id("Passwd")).sendKeys("password");
fd.findElement(By.id("signIn")).click();
fd.manage().timeouts().implicitlyWait(100,TimeUnit.SECONDS);
fd.findElement(By.xpath("/html/body/div[5]/div[2]/div/div[2]/div/div/div/div[2]/div/div/div/div/div")).click();
fd.findElement(By.className("vO")).click();
fd.findElement(By.className("vO")).sendKeys("ToUserID@gmail.com");
fd.findElement(By.className("aoT")).click();
fd.findElement(By.className("aoT")).sendKeys("Email Subject: Hiiiii");
fd.findElement(By.xpath("/html/body/div[9]/div/div/div/div/div[2]/div/div/div/div/div/div[3]/div/div/div[4]/table/
tbody/tr/td[2]/table/tbody")).click();
fd.findElement(By.xpath("/html/body/div[9]/div/div/div/div/div[2]/div/div/div/div/div/div[3]/div/div/div[4]/table/
tbody/tr/td[2]/table/tbody")).sendKeys("Writing email body");
fd.findElement(By.cssSelector("div[class='T-I J-J5-Ji aoO T-I-atl L3']")).click();
}
}

sree.cs10@gmail.com

Posts : 3
Join date : 2013-06-10
Age : 27
Location : Hyderabad

Back to top Go down

Re: automate gmail to sent email using webdriver

Post by sree.cs10@gmail.com on Tue Jun 18, 2013 12:17 am

Hi soumyacr88,

Above code is worked on my machine. Pls try and let me know if you are facing any problems.

Thanks,
Srikanth


Last edited by sree.cs10@gmail.com on Tue Jun 18, 2013 12:18 am; edited 1 time in total (Reason for editing : Few corrections)

sree.cs10@gmail.com

Posts : 3
Join date : 2013-06-10
Age : 27
Location : Hyderabad

Back to top Go down

Re: automate gmail to sent email using webdriver

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum