Selenium Clicks but Doesn't Select
Question: I'm working on making an automated web scraper run on Khan Academy to make
offline backups of questions using selenium and a python scraper (to come
later). I'm currently working on getting it to answer questions (right or
wrong doesn't matter) to proceed through exercises. Unfortunately, selenium's
.click() function doesn't actually select an answer. I think it has something
to do with being pointed at the wrong object but I can't tell. It currently
highlights the option, but doesn't select it.

[HTML for a single option (out of 4)](http://pastebin.com/RXwDUAAw)

I made some code to reproduce the error, and hooked it up to a test account
for all your debugging needs. Thanks.

    
    
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    
    driver = webdriver.Firefox()
    
    # gets us to the SAT Math Exercise page
    driver.get('https://www.khanacademy.org/mission/sat/tasks/5505307403747328')
    
    # these next lines just automate logging in. Nothing special.
    login = driver.find_element_by_name('identifier')
    login.send_keys('stackflowtest') # look, I made a new account just for you guys
    passw = driver.find_element_by_name('password')
    passw.send_keys('stackoverflow')
    button = driver.find_elements_by_xpath("//*[contains(text(), 'Sign in')]")
    button[1].click()
    
    driver.implicitly_wait(5) # wait for things to become visible
    radio = driver.find_element_by_class_name('perseus-radio-option')
    radio.click()
    check = driver.find_element_by_xpath("//*[contains(text(), 'Check answer')]")
    check.click()
    


Answer: After a trial and error process, I found that the actual click selection can
be accomplished by pointing to the element with class "description"

    
    
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    
    driver = webdriver.Firefox()
    
    # gets us to the SAT Math Exercise page
    driver.get('https://www.khanacademy.org/mission/sat/tasks/5505307403747328')
    
    # these next lines just automate logging in. Nothing special.
    login = driver.find_element_by_name('identifier')
    login.send_keys('stackflowtest') # look, I made a new account just for you guys
    passw = driver.find_element_by_name('password')
    passw.send_keys('stackoverflow')
    button = driver.find_elements_by_xpath("//*[contains(text(), 'Sign in')]")
    button[1].click()
    
    driver.implicitly_wait(5) # wait for things to become visible
    radio = driver.find_element_by_class_name('description')
    radio.click()
    check = driver.find_element_by_xpath("//*[contains(text(), 'Check answer')]")
    check.click()
    

For people dealing with similar issues, I would recommend clicking on the very
edge of the space that allows you to select and inspecting the element there.
This prevents you from accidentally using one of the innermost tags.

