You are currently viewing How do you automate Yahoo emails in python?
How Do You Automate Yahoo Emails In Python?

How do you automate Yahoo emails in python?

Spread the love

Hello friends, In this article we will see Yahoo mail login using Python coding in step by step. 

How Do You Automate Yahoo Emails In Python?
How Do You Automate Yahoo Emails In Python?

Which is different Steps required for Yahoo mail login using Python code

  1. We need to Setting up Firefox driver using Selenium
  2. Then set the Fullpath name, where the geckodriver.exe file we placed.
  3. The login page URL (For exam https://login.yahoo.com) – GET Request operation
  4.  XPATH for username – Send_Keys (it can also be CSS selector, class name or tag instead of XPATH):  //*[@id=”login-username”]
  5. XPATH for pressing Enter key using Selenium: //*[@id=”login-username”]
  6. XPATH for the password – Send_Keys operation : //*[@id=”login-passwd”]
  7. Locate element by ID to press return or Enter Key using Selenium and sending a post request : login-passwd

Python code for automate Yahoo emails in python?

from selenium import webdriver

from selenium.webdriver.firefox.options import Options

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.common.by import By

from selenium.webdriver.common.keys import Keys

from time import sleep



options = Options()

driver = webdriver.Firefox(options=options, executable_path=r'C:\driver\geckodriver.exe')

wait = WebDriverWait(driver, 10)

driver.get('https://login.yahoo.com')

driver.maximize_window()

sleep(5)

driver.find_element_by_xpath('//*[@id="login-username"]').send_keys('username')

sleep(5)

driver.find_element_by_xpath('//*[@id="login-username"]').send_keys(Keys.RETURN)

sleep(5)

driver.find_element_by_xpath('//*[@id="login-passwd"]').send_keys('password')

sleep(5)

wait.until(EC.presence_of_element_located((By.ID, 'login-passwd'))).send_keys(Keys.RETURN)

Summary :

In this article we saw How to login to Yahoo mail using Python coding so about this section you have any query then free to ask me

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply