Wednesday 13 February 2013

How to add an attachment in Gmail using selenium RC/Webdriver

Can some one tell me how can i add attachment in Gmail/Yahoo mail using selenium RC/Webdriver. Please help me out in this situation. Thanks in advance. Answer: Install Autoit in your machine. Write an AutoIT script as shown below. WinWaitActive("Choose file") \\specify the name of the choose window Send("C:\attach\samplefile.txt") \\location of the file you want to attach Send("{ENTER}") After writing the code, save a the file as attach.exe Add the below line to your selenium code(if using java) Runtime.getRuntime().exec("c:\\path\\attach.exe"); The above will be helpful in adding an attachment. Hope it helps!

No comments:

Post a Comment