Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
dkpune
Posts : 6
Join date : 2012-03-14

Send email automatically Empty Send email automatically

Sat Mar 24, 2012 2:49 am
I want to send an email (from outlook) automatically from script when smoke test is compelted. Please share the java code which can be used in Selenium.
rohit13
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 37
Location : INDIA
http://radical-qa.blogspot.in/

Send email automatically Empty Re: Send email automatically

Tue Apr 10, 2012 3:31 pm
I don't have idea regarding mail functionality by outlook but here is code for Gmail

Just need to add code at the end of your script, n it will send email.

Code:
public class email extends SeleneseTestCase {
    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://selenium.brodos.net/");
        selenium.start();
    }

    @Test
    public void testEmail() throws Exception {
        selenium.open("http://www.gmail.com");
        selenium.type("id=Email", "test");
        selenium.type("id=Passwd", "test");
        selenium.click("id=signIn");
        selenium.waitForPageToLoad("30000");
        selenium.clickAt("//div[@id=':oy']/div/div", "");
        selenium.type("name=to", "test@test.com");
        selenium.type("name=subject", "testSubject");
        selenium.type("css=body[class='editable  LW-avf']", "asdasd");
        selenium.keyPress("//div/b[text()='Send']", "13");
    }

    @After
    public void tearDown() throws Exception {
        selenium.stop();
    }
}


Hope it will work for you..
avatar
tarun3kumar
Master
Master
Posts : 186
Join date : 2012-02-14
http://seleniumtests.com

Send email automatically Empty Re: Send email automatically

Thu Apr 12, 2012 1:29 pm
A better approach could be to use build tool like ant to send email of test results. I assume that you are not using any CI system else it would have been way easier.
You could find more on ant mail task here - http://ant.apache.org/manual/Tasks/mail.html
Sponsored content

Send email automatically Empty Re: Send email automatically

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