Search code examples
seleniumidegmail

How to automate new gmail UI to send email by using Selenium IDE?


The current gmail UI has changed, it opens in a pop up DIV and the ID parameters are changing for each new compose window. Can anyone try to give me the code?


Solution

  • You can do all using XPath (find using By.xpath("xpath expression")):

    • Open the gmail page
    • Login as usual
    • Click on compose button (its XPath expression: "//div[text()='COMPOSE']")
    • (The email dialog will pop up)
    • Type (send keys) the addesses in the "To" text area: "//textarea[@name='to']"
    • Type (send keys) the subject to the "Subject" input: "//input[@name='subjectbox']"
    • Type (send keys) the email content to the editable div: "//div[@class='gmail_default']" (or "//div[@aria-label='Message Body']"), as it seems they changed their HTML recently)
    • Hit send: "//div[text()='Send']"