1

I am trying to scrape a site that requests my username and password. I have found a way to use selenium but I have to manually enter in my credentials. I would like the chrome driver to automatically enter my credentials and get to work.

I have tried to use select functions and send keys but nothing seems to work. I think the reason is that the prompt looks like a localhost prompt and it is not in the webpage itself

url = "http://www.incidentpage.net/members/ticker_content.js"

# create a new Chrome session (NEED TO MANUALY INPUT CREDENTIALS)
# Username is 'Jack Bibi' 
# Password is 'IPN545'
driver = webdriver.Chrome('./chromedriver')
driver.implicitly_wait(3)
driver.get(url)

Here is a screenshot to what the link pulls up.

prompt

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Jack Bibi
  • 11
  • 2

1 Answers1

1

This looks to be standard HTTP Auth and not a login form that requires submitting via Selenium. Try using the HTTP Auth pattern of http://user:pass@host... like this:

driver.get('http://{un}:{pw}@incidentpage.net/members/ticker_content.js'.format(un='foo', pw='bar'))

To read more about HTTP Authentication, check out Mozilla's docs.

This other SO post is relevant as well.

williamrfry
  • 350
  • 3
  • 11