18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Webmail Automation
Hi all,
I am trying to automate webmail posting through GMail, Yahoo Mail. I have got little success with Yahoo Mail and almost zero with Gmail.
Yahoo Mail Case
Also, I couldn't fill in content in webmail body as the controller was unable to capture the content. Any comments on how can the webmail body be filled with content.
GMail Case
All comments are very welcome. Please not the password has been removed in the above code.
Regards,
protect
I am trying to automate webmail posting through GMail, Yahoo Mail. I have got little success with Yahoo Mail and almost zero with Gmail.
Yahoo Mail Case
function navigateToYahooAndLogin($username, $passwd) {
_setValue(_textbox("q"), "yahoo mail");
_click(_submit("Google Search"));
_click(_link("Yahoo! Mail: The best web-based email!"));
_setValue(_textbox("login"), $username);
_setValue(_password("passwd"), $passwd);
_click(_submit("Sign In"));
}
function uploadFile() {
_wait(1500);
_setFile(_file("uploadfile"), "C:\\protecttest\\test.txt");
_wait(1500);
}
function sendMail() {
_click(_cell("compose_button_label"));
//_wait(500);
uploadFile();
_setValue(_textarea("To"), "protect.test@gmail.com");
_setValue(_textarea("Cc"), "");
_setValue(_textbox("Subject"), "test Sahi");
//_click(_cell("SendMessageButton_label"));
_click(_cell(_table("btnTbl_send_message"), 0, 1));
}
navigateToYahooAndLogin("protect.test", "PasswordRemoved");
_wait(1500);
_click(_byId("_test_Inbox"));
sendMail();
_wait(1500);
_click(_link("Sign Out"));
I am able to send a mail with subject line but the file upload does not happen. There was no error in the log. Adding _wait() also didn't help in uploading the file. How do I enable the file upload operation?Also, I couldn't fill in content in webmail body as the controller was unable to capture the content. Any comments on how can the webmail body be filled with content.
GMail Case
function navigateToGmailAndLogin($username, $passwd) {
_setValue(_textbox("q"), "gmail");
_click(_submit("Google Search"));
_click(_link("Gmail: Email from Google"));
_setValue(_textbox("Email"), $username);
_setValue(_password("Passwd"), $passwd);
_click(_submit("Sign in"));
}
function sendMail() {
_click(_byId("1fb6"));
_setValue(_textarea("to"), "protect.test@gmail.com, protect.test@yahoo.com");
_setValue(_textbox("subject"), "test sahi");
_click(_submit("Send"));
}
navigateToGmailAndLogin("protect.test", "PasswordRemoved");
_wait(3000);
sendMail();
_wait(1500);
_click(_link("Sign out"));
In GMail, many fields are accessed by random ids. How should one handle dynamically generated fields in Gmail and similar sites? The file upload and mail content can be accessed through these random ids. How can one set identify these fields and set the appropriate content?All comments are very welcome. Please not the password has been removed in the above code.
Regards,
protect
Comments
I used something like _rteWrite(_byID(":7o"),"Dear John, This is to ...");
RR