I'm trying to send an email from Gmail's web interface with Python using Selenium, but I'm stuck on the part of selecting the Compose part.
This is my code:
from selenium import webdriver
import time
driver = webdriver.Chrome('C:\chromedriver.exe')
driver.get('https://www.gmail.com/')
driver.implicitly_wait(5)
loginBox = driver.find_element_by_xpath('//*[@id ="identifierId"]')
loginBox.send_keys('xxxxxxxxxxxxxxxxx')
nextButton = driver.find_elements_by_xpath('//*[@id ="identifierNext"]')
nextButton[0].click()
passWordBox = driver.find_element_by_xpath('//*[@id ="password"]/div[1]/div / div[1]/input')
passWordBox.send_keys('xxxxxxxxxxxx')
nextButton = driver.find_elements_by_xpath('//*[@id ="passwordNext"]')
nextButton[0].click()
time.sleep(2)
#compose = driver.find_element_by_xpath('/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div[2]/div/div/div/div[1]/div/div')
#compose.click()
driver.get('https://mail.google.com/mail/u/0/#inbox?compose=new')
time.sleep(2)
compose_button_xpath="/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div[2]/div/div/div/div[1]/div/div"
#driver.find_element_by_xpath(compose_button_xpath).click()
driver.find_element_by_xpath("//textarea[@name='to']").send_keys("abc@gmail.com")
driver.find_element_by_xpath("//*[@id=':12s']").send_keys("Content")
driver.find_element_by_xpath("//*[@id=':11d']").click()
Can you help me? How can I solve this?