Open In App

Sign in Geeksforgeeks using Python Selenium

Last Updated : 04 Jan, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Project Description:
Here, we’re going to study a simple how-to log in GFG by selenium. Selenium is a free tool for automated trying out across exceptional browsers. then a simple requirement id and password.

Requirements :

  • Selenium – Selenium Python Introduction and Installation
  • Steps to setup –

    • First, go to the GeeksforGeeks website using this Link.
    • Then click on investigate element by urgent ctrl + shift + i or stepping into setting of browser and clicking on investigate detail manually.
    • Then navigate box where  email, or username are filled then copy the x_path.

    • Then navigate the Password then copy the x_path.

    • Then navigate the Sign-in button then copy the x_path.

    Implementation:




    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    import time
      
    # create instance of Chrome webdriver
    driver = webdriver.Chrome() 
      
      
    # find the element where we have to 
    # enter the xpath
    # fill user or mail id
    driver.find_element_by_xpath('//*[@id ="luser"]').send_keys('praveeny182')
      
    # find the element where we have to 
    # enter the xpath
    # fill password
    driver.find_element_by_xpath('//*[@id ="password"]').send_keys('xXXXXX')
      
    # find the element sign in 
    # request using xpath 
    # clicking on that element 
    driver.find_element_by_xpath('//*[@id ="Login"]/button').click()
          
        

    
    

    Output –
    You will eventually be logged in to geeksforgeeks in the browser where selenium is running.


    Like Article
    Suggest improvement
    Previous
    Next
    Share your thoughts in the comments

Similar Reads