Python 3 Selenium Automation Script to Find Button on Webpage by Text & Click it Full Project For Beginners

 

 

Installation:

Make sure you have Selenium installed using

 

 

pip install selenium

 

 

And also download the WebDriver for your web browser :

Chrome : https://chromedriver.chromium.org/downloads
Firefox : https://github.com/mozilla/geckodriver/releases
Safari : https://webkit.org/blog/6900/webdriver-support-in-safari-10/

 

 

app.py

 

 

# import module
from selenium import webdriver
import time

# Create the webdriver object. Here the
# chromedriver is present in the driver
# folder of the root directory.
driver = webdriver.Chrome(r"./driver/chromedriver")

# get https://www.geeksforgeeks.org/
driver.get("https://www.geeksforgeeks.org/")

# Maximize the window and let code stall
# for 10s to properly maximise the window.
driver.maximize_window()
time.sleep(10)

# Obtain button by link text and click.
button = driver.find_element_by_link_text("Sign In")
button.click()

Leave a Reply