0

I tried to authenticate a webpage(oracle BI dashboard) using Python selenium webdriver for Firefox. The module is running on CentOS. I wrote the below code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
profile = webdriver.FirefoxProfile()
profile.set_preference('network.http.phishy-userpass-length', 255)
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("http://username:pwd@abc.com")

It is going to the website but not logging in. I went through tens of threads on stackoverflow regarding this but none of the methods worked.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Flying falcon
  • 133
  • 2
  • 9
  • have you tried to fill username/password fields with `send_keys` method or it's not applicable in your case? – Andersson Aug 19 '15 at 11:08
  • 1
    driver = webdriver.Firefox() driver.get('http://username:pwd@abc.com') wait(driver, 5).until(EC.alert_is_present()) alert = driver.switch_to_alert() alert.send_keys('username') alert.send_keys(Keys.TAB) alert.send_keys('pwd') alert.accept() I get the below error. Is it because the version mismatch between selenium and python? >>> wait(driver, 5).until(EC.alert_is_present()) Traceback (most recent call last): File "", line 1, in File "/u/lni/python-2.7.5/lib/python2.7/site-packages/selenium-2.47.1-py2.7.egg/selenium/webdriver/support/wait.py", line 76 raise – Flying falcon Aug 19 '15 at 11:24
  • I guess this is not full error log, so I can't make suggestions.. – Andersson Aug 19 '15 at 11:33
  • This is the full error log >>> wait(driver, 5).until(EC.alert_is_present()) Traceback (most recent call last): File "", line 1, in File "/u/lni/python-2.7.5/lib/python2.7/site-packages/selenium-2.47.1-py2.7.egg/selenium/webdriver/support/wait.py", line 76, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: – Flying falcon Aug 19 '15 at 11:35
  • There is a login page on your website or just popup prompt for entering user's credentials? – Andersson Aug 19 '15 at 15:27
  • It is a login page on the website. – Flying falcon Aug 20 '15 at 11:39
  • I tried to get to few websites with `FirefoxProfile` authentication method, but it seems that it only works with popup login dialog-boxes.. You should identify your username/passwords input fields elements with `driver.find_element_by_...()` and input user's credentials with `send_keys()`. This should work anyway – Andersson Aug 20 '15 at 12:23
  • Are you sure that HTTP Basic authentication is actually used? As you say you have a login form, that seems rather unlikely to me. – jsfan Feb 21 '16 at 06:49

0 Answers0