0

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.

Quick learner
  • 699
  • 4
  • 22
  • 39
  • You can use AutoIT tool for handling window gui and attach the files. visit www.autoitscript.com – HemChe Feb 13 '13 at 07:23

2 Answers2

0

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!

HemChe
  • 2,249
  • 1
  • 21
  • 33
  • downloaded autoit tool but when am tring to run the script am getting one alert. In stack overflow i dont know how can i attach image. Please find the image in the below link:http://edutechquestions.blogspot.in/2013/02/how-to-add-attachment-in-gmail-using.html – Quick learner Feb 13 '13 at 09:48
  • download autoit files from here http://www.findthatzipfile.com/download.php?i=12632497&t=hZIP Write the autoit script. Save the file as attach.au3 Then convert the attach.au3 file to attach.exe file using the following utility present in the downloaded zip file Aut2Exe.exe (73 kb) After conversion, place the path of exe file in your code. Let me know if you still face any issues. In this process, there is no need to install AutoIT software. you just need to unzip the file and use the utilities. – HemChe Feb 18 '13 at 16:45
0

I found the answer for this question using robot api. Thanks for ppl who responds this question.

Quick learner
  • 699
  • 4
  • 22
  • 39