Search code examples
pythonseleniumselenium-webdrivergmailselenium-remotedriver

Unable to add multiple email addresses to sendkeys() while using Selenium


Unable to add multiple email addresses to sendkeys() while using Selenium. What I'm trying to do is send an email to multiple addreses using selenium remote webdriver to build some test cases.

The below logic only sends the email to the first recipient.

email = "[email protected],[email protected]"
driver.find_element_by_name("to").send_keys(email)

The below logic executes fine without throwing any exception but it does not generate the email at all.

emails = ["[email protected]","[email protected]"]
for email in emails:
    time.sleep(5) #to wait for the element to be interactable
    driver.find_element_by_name("to").send_keys(email)

Could someone please guide in the right direction? Thanks!


Solution

  • UPDATE: SOLUTION FOUND

    The email addresses require space in between and it works just fine without looping.