Reputation: 13
I'm trying to automate gmail with selenium to automatically send email as a proof of concept for my boss, but I can't make it to click on the send button.
Could someone help me?
Upvotes: 1
Views: 3067
Reputation: 4536
To attach a file, try following Se IDE code:
<tr>
<td>click</td>
<td>//span[text()='Attach a file']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>css=.LIODqc</td>
<td>C:\Path\To\file.txt</td>
</tr>
Updated for entering data in 'To', 'Subject', Attachment, mail body and then sending mail:
<tr>
<td>type</td>
<td>name=to</td>
<td>[email protected]</td>
</tr>
<tr>
<td>type</td>
<td>name=subject</td>
<td>testSubject</td>
</tr>
<tr>
<td>click</td>
<td>//span[text()='Attach a file']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>css=.LIODqc</td>
<td>C:\Path\To\file.txt</td>
</tr>
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>css=body[class='editable LW-avf']</td>
<td>Surya</td>
</tr>
<tr>
<td>keyPress</td>
<td>//div/b[text()='Send']</td>
<td>13</td>
</tr>
Upvotes: 1