17

For a long time I've been using a python bot to do some work task. Among others things, the bot has to pass an authentication window.

The code of this in the python program is the following:

driver = webdriver.Firefox(firefox_profile=profile)
...
driver.get('https://example.com')
driver.switch_to.alert.send_keys('123456' + Keys.TAB + '123456')
driver.switch_to.alert.accept()

But yesterday it throwed this error:

selenium.common.exceptions.WebDriverException: Message: User prompt of type promptUserAndPass is not supported

I've been googling but I even don't find results about this kind of exception and how to deal with this problem.

Any ideas?

Thanks in advance!

7
  • 1
    I have the same issue. Code was working fine before but now seems broken.
    – Phil
    Commented May 25, 2019 at 11:31
  • 1
    have your firefox updated .. try to use old version of firefox Commented May 25, 2019 at 21:33
  • 1
    @ShubhamJain. I've tried both. My version was already updated to the newest and I've downloaded and old one and just after open the browser, it automatically updates. Anyway, even if I found any workaround, deal with different minor versions of firefox is not the solution.
    – cooper
    Commented May 25, 2019 at 21:38
  • 1
    I have the same issue +1
    – user568021
    Commented May 26, 2019 at 8:49
  • 1
    github.com/SeleniumHQ/selenium/issues/7239
    – Lukasz
    Commented May 30, 2019 at 7:42

2 Answers 2

11

It seems that HTTPAuth dialogs are not supported by any drivers at the moment.
Firefox implemented an workaround which does not work anymore in 67.0. It appears they cannot start adding support for the HTTP authentication prompt right now, due to missing specifications.

https://bugzilla.mozilla.org/show_bug.cgi?id=1556026

https://bugzilla.mozilla.org/show_bug.cgi?id=1556307

https://github.com/w3c/webdriver/issues/385

I've managed to workaround this problem by installing Firefox 66.0 under a different name and then mentioning its location when calling the FirefoxDriver, like @elead1 did.

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver import Firefox

path = FirefoxBinary("/path/to/Firefox2/firefox-bin")
browser = Firefox(firefox_binary=path)
1
  • I could also get past this problem by setting the username / password with my Firefox profile and then assigning the test to use my own profile rather than an ad hoc test profile. Then you'll just want to accept the prompt to get past the authorization. You could also try to set the Authorization header using python -- Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= , where the string is "username:password" encoded with Base64. I'm using robot so this is not an option.
    – sampoh
    Commented Nov 27, 2019 at 8:23
6
+50

I don't have enough rep to comment and I know this isn't "solving" the problem, but I was able to work around this problem by using the Firefox ESR.

You can install the ESR parallel to your main Firefox installation, and then specify which binary the FirefoxDriver will use:

driver = webdriver.Firefox(firefox_profile=profile, firefox_binary="/path/to/esr/binary")
3
  • still the same exception: selenium.common.exceptions.WebDriverException: Message: User prompt of type promptUserAndPass is not supported
    – bzhu
    Commented Dec 10, 2019 at 2:58
  • Which version of Firefox ESR did you install? There's a good chance the newest version (68.3) has also removed the necessary functionality. When I posted my answer, I believe I was using 66, or possibly 60.
    – elead1
    Commented Dec 11, 2019 at 4:55
  • just checked, as my company pushed down a newer version of Firefox which broke my scripts. 60.1.0 ESR works, 60.9.0 ESR works, Firefox 66.0.5 (non-esr) works. multiple 68.x.0 ESR versions do NOT work. ftp.mozilla.org/pub/firefox/releases
    – Brian W
    Commented Sep 29, 2020 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.