Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium.webdriver import Firefox
- from selenium.webdriver.common.by import By
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.firefox.options import Options
- from selenium.webdriver.support import expected_conditions as expected
- from selenium.webdriver.support.wait import WebDriverWait
- options = Options()
- options.add_argument('-headless')
- driver = Firefox(executable_path='/usr/local/bin/geckodriver', options=options)
- wait = WebDriverWait(driver, timeout=10)
- driver.get('https://mail.google.com/')
- driver.find_element(By.XPATH,'//*[@id="identifierId"]').send_keys("")
- driver.find_element(By.XPATH,'//*[@id="identifierNext"]').click()
- WebDriverWait(driver, 10).until(expected.visibility_of_element_located((By.XPATH, '//*[@id="password"]/div[1]/div/div[1]/input')))
- driver.find_element(By.XPATH,'//*[@id="password"]/div[1]/div/div[1]/input').send_keys("")
- driver.find_element(By.XPATH,'//*[@id="passwordNext"]').click()
- WebDriverWait(driver, 10).until(expected.visibility_of_element_located((By.XPATH, '/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div')))
- driver.find_element(By.XPATH,'/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div').click()
- driver.find_element(By.XPATH,'//*[@id=":9l"]').send_keys("djcloudtron3@gmail.com")
- driver.find_element(By.XPATH,'//*[@id=":93"]').send_keys("testing")
- driver.find_element(By.XPATH,'//*[@id=":a8"]').send_keys("hello world")
- driver.find_element(By.XPATH,'//*[@id=":8t"]').click()
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement