What is the updated way to write find elements by link text? long story longer... I have about 4000 links on various pages of a website to click. (If I can automate this I can use it as a template for the rest of the common link texts as well on other pages)
specifically, I need to know where I went wrong? Been at this for some time now. I decided to throw in the towel for the night but I cannot find a workaround that is liked my mac terminal/visual studio/ pylance. they all love to yell lol. anyway, I am on a MacBook Pro Laptop and I'd really appreciate some help!
import webbrowser
import time
from selenium import webdriver
driver = webdriver.Chrome
# Not an actual link for public purposes
URL = "https://banfaouf.com/lfmamdofpisao"
webbrowser.open(URL)
# Find all links that contain specific text (e.g., 'Click Me' in this example)
links = driver.find_elements_by_link_text('Download File')
# Add a time delay (in seconds) between clicks
time_delay_between_clicks = 2 # Adjust this value as needed (e.g., 2 seconds)
# Click each link with a time delay between clicks
for link in links:
link.click()
time.sleep(time_delay_between_clicks)```
(This is my first post on this platform!) Idk if this makes any difference but among factors to consider: I' using: MacBook Pro (all up to date) and Mac Terminal is also in working order Latest Version of Python
- Selenium
- VS Code
- chrome driver
have been installed