Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

» Selenium IDE Verify different Maps (Hybridview, Mapview etc.)
Fri Nov 25, 2016 9:56 pm by DJ87

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 Today at 1:13 am


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