Monday, April 22, 2013

Automatically login to Yahoo Mail and send a mail using Selenium IDE ? - Yahoo Mail automated.

      As we did automatic mail sending at GMail by using Selelnium IDE we can do the same at Yahoo mail too by just recording the login and emailing steps.


This is very useful when you want to send test mails as part of testing, this saves time when you have to send different mails to different mailing list. You can use the html source and fill the contact lists and compose the mails prior to doing the task. You need not wait for server response for each individual mail sent status.


Here is the recorded code :

Login to Yahoo Mail:





Source:


---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://mail.google.com/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>/config/login_verify2?&amp;.src=ym</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>McKiran7890@yahoo.co.in</td>
</tr>
<tr>
    <td>type</td>
    <td>id=passwd</td>
    <td>Test123</td>
</tr>
<tr>
    <td>click</td>
    <td>id=.save</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
---------------------------------------



Compose and send Mail: 





Source:

---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://login.yahoo.com/" />
<title>ComposeMail</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">ComposeMail</td></tr>
</thead><tbody>
<tr>
    <td>click</td>
    <td>//a[text()=&quot;Compose&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=to-field</td>
    <td>McKiran@example.com</td>
</tr>
<tr>
    <td>type</td>
    <td>id=subject-field</td>
    <td>Hello</td>
</tr>
<tr>
    <td>type</td>
    <td>//body[@aria-label='Message Body']</td>
    <td>Hi All,<br/><br/>Hope the test is successful.<br/><br/><i>Lovingly,<i><br/><b>McKiran</b></td>
</tr>
<tr>
    <td>click</td>
    <td>//a[text()=&quot;Send&quot;]</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
---------------------------------------




Logout:



Source:

---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://in-mg61.mail.yahoo.com/" />
<title>LogOut</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">LogOut</td></tr>
</thead><tbody>
<tr>
    <td>click</td>
    <td>class=yucs-signout</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
---------------------------------------



This is how it looks at GMail:

 

1 comment:

  1. Thanks for your informative article on software testing. Your post helped me to understand the future and career prospects in software testing. Keep on updating your blog with such awesome article. Best software testing training institute in Chennai

    ReplyDelete