user3522371
user3522371

Reputation:

Authentication with selenium (Python)

I have the links to the admin area of my website: it is possible to launch those URIs (links) with selenium (in a given browser) without needing to authenticate previously ? If not, then how could I deal with authentication using selenium ?

Upvotes: 3

Views: 11337

Answers (1)

Granitosaurus
Granitosaurus

Reputation: 21406

Not sure what you mean but you can just use selectors and enter credentials to the authentication fields. i.e.

from selenium import webdriver
driver = webdriver.Firefox()
driver.get(url)
driver.find_element_by_id("IDOFLOGIN").sendKeys("YOUR LOGIN")
driver.find_element_by_id("PASSOFLOGIN").sendKeys("YOUR PASSWORD")
driver.find_element_by_id("login button").click()
# Continue

you can find element not necessarily by ID you can also you class, xpath and so on.

Upvotes: 5

Related Questions