I want to scrape a local website using selenium and need to send Username and Password to be logged in but there is no inspect element to find these elements. The website is like this:
Asked
Active
Viewed 336 times
0

Aref Farzaneh
- 29
- 6
-
have you tried this? https://stackoverflow.com/questions/43434362/how-can-i-send-user-name-and-password-in-popup-using-selenium – Muhammad Junaid Haris Nov 18 '20 at 08:56
2 Answers
1
To send keys to popup using Selenium, you can first switch your target to the popup
obj = driver.switch_to.alert
Then send keys using
obj.send_keys(username)
obj.send_keys(str(Keys.TAB)) # send a tab to go to the next field
obj.send_keys(password)
Reference: Handle alert popup inselenium

kennysliding
- 2,783
- 1
- 10
- 31
0
First of all, try this URL format in driver.get()
:
http://username:password@the-site.com

Wasif
- 14,755
- 3
- 14
- 34