Why doesn't my selenium webdriver authentication work (Django 1.9)
<p>I am going through a process of registering and logging in for a list of users.</p>

<p>I am using the same username and password to make things simple.  </p>

<pre><code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import re

for address in geolocations:

    # register
    browser.get("http://127.0.0.1:8000/register")

    username = browser.find_element_by_id("id_username")
    print("username is being set as " + re.sub(' ', '', address))
    password = browser.find_element_by_id("id_password")
    print("password is being set as " + re.sub(' ', '', address))
    location = browser.find_element_by_id("location")
    submit = browser.find_element_by_id("register")
    username.clear()
    password.clear()
    location.clear()
    username.send_keys(re.sub(' ', '', address))
    password.send_keys(re.sub(' ', '', address))
    location.send_keys(address)
    location.send_keys(Keys.RETURN)
    submit.click()
    browser.implicitly_wait(1)


    # login
    browser.get("http://127.0.0.1:8000/login")
    username = browser.find_element_by_id("username")
    password = browser.find_element_by_id("password")
    username.clear()
    password.clear()
    password.send_keys(re.sub(' ', '', address)) # addresses have spaces
    print("password is being set as: " + re.sub(' ', '', address))
    browser.implicitly_wait(2)
    submit = browser.find_element_by_id("submit")
    submit.click()    
    browser.implicitly_wait(2)

browser.quit()
</code></pre>

<p>Even though the same string is being used for registering and logging in, the login authentication is not working.  But the same username/password combos work when I register/login manually.</p>

<p>Can anyone tell me what's causing this?</p>

<p>In the login section of your test, it looks like you have forgotten to call <code>username.send_keys()</code>.</p>

python django selenium authentication login