How to Submit HTTP authentication with Selenium python-binding webdriver

0 votes

I'm using Selenium python binding to setup an automation test for our web application. I'm facing a problem while testing the web on beta server because it requires HTTP authentication for an intranet username and password.

from selenium import webdriver

driver = webdriver.Firefox()
driver.get("https://www.edureka.co/")

I need to submit a username and a password for the popup dialog upon accessing a website.

Is there a better way to do this?

Sep 25, 2018 in Selenium by Christine
• 15,790 points
4,774 views

1 answer to this question.

0 votes

I have found a solution to this question:

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.set_preference('network.http.phishy-userpass-length', 255)
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("https://username:password@somewebsite.com/")

The FirefoxProfile part is to dismiss the confirmation dialog because by default Firefox will show a popup dialog to prevent pishing.

answered Sep 25, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

+1 vote
1 answer

How to handle notifications in Python with Selenium (Chrome WebDriver)

Below will help you: You can disable the ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
14,473 views
0 votes
1 answer
0 votes
1 answer

How to Select date from a datepicker with Selenium Webdriver using Python?

Hi Yashim, you can select date from ...READ MORE

answered Jul 31, 2019 in Selenium by Abha
• 28,140 points

edited Oct 7, 2021 by Sarfaraz 10,967 views
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,770 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,187 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,262 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,901 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP