'Python selenium send_keys not working on password field
send_keys() works with the username field but not the password field. Here is my code:
class PpeLiveTest(LiveServerTestCase):
# test that the first cell for the tennessee total row is the correct sum
# for quince and allenbrooke for the incentives table
def test_sums_incentives_tennessee(self):
options = webdriver.FirefoxOptions()
options.add_argument("--headless")
driver = webdriver.Firefox(options=options)
driver.get('https://[redacted]/pr-run-ppe?group=MS%2FTN%2FLA&check_date=05%2F01%2F2022')
# login first
username_element = driver.find_element_by_id('id_login')
username_element.send_keys('[redacted]')
password_element = driver.find_element_by_id('id_password')
password_element.send_keys(os.environ.get('ADMIN_PASS'))
login_button = driver.find_element_by_xpath('/html/body/div/div/div/form/button')
login_button.click()
I look at driver.page_source in the console when running this test. It's still the login page. username is filled with the [redacted] as expected but the password field is blank. Anyone know why?
os.environ.get('ADMIN_PASS') is not blank.
password_element is the correct element that we expect
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
