Hello friends, In this article we will see Yahoo mail login using Python coding in step by step.
Table of Contents
Which is different Steps required for Yahoo mail login using Python code
- We need to Setting up Firefox driver using Selenium
- Then set the Fullpath name, where the geckodriver.exe file we placed.
- The login page URL (For exam https://login.yahoo.com) – GET Request operation
- XPATH for username – Send_Keys (it can also be CSS selector, class name or tag instead of XPATH): //*[@id=”login-username”]
- XPATH for pressing Enter key using Selenium: //*[@id=”login-username”]
- XPATH for the password – Send_Keys operation : //*[@id=”login-passwd”]
- 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