poop
poop

Reputation: 41

How to find elements by href value using selenium python?

Is there any way to pull links from href values and open them one by one, and perform an action (click) on a specific ID?

Upvotes: 1

Views: 70

Answers (1)

Vova
Vova

Reputation: 3543

First, find element by ID

element = driver.find_element_by_id('YOUR_ID')

Second, get attribute from your element

link = element.get_attribute("href")

Third, use selenium, but I would suggest using something like requests, and perform GET request by this link:

import requests
response = requests.get(link)
assert response.status_code == 200

for example

Upvotes: 2

Related Questions