Uncategorized

How to click a href link text in Python Selenium

import time
from csv import writer
#SELENIUM LIBRARIES
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
#REQUIRED FOR HEADLESS PART 1
from selenium.webdriver.chrome.options import Options
#REQUIRED FOR HEADLESS
from selenium.webdriver.chrome.service import Service


#Set location of Chrome Driver
s = Service('/usr/local/bin/chromedriver')

#Set some selenium chrome options
chromeOptions = Options()
chromeOptions.headless = False
driver = webdriver.Chrome(service=s, options=chromeOptions)

list_data = []

def initialize_browser():
    driver.get("InsertYOURURL")
    print("starting_Driver")
    click_button = driver.find_element(by=By.LINK_TEXT, value="June 2022")
    click_button.click()

initialize_browser()

#driver.quit()