Q:

Using selenium in python, how do I get past "Message: Element is not currently visible"?

This question is similar to others, but none of the other solutions seem to work.
In the website 'http://www.ncbi.nlm.nih.gov/pubmed/', after searching for text, you get a chance to 'Sort by most recent' value.  I would like to select one of these values.
Here is my code, which includes the website I am trying to parse:
from selenium import webdriver
from pyvirtualdisplay import Display
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

SearchTerm = raw_input("Enter search terms: ")
display = Display(visible=0, size=(1024, 768))
display.start()
browser = webdriver.Firefox()
browser.get("http://www.ncbi.nlm.nih.gov/pubmed/")
assert "PubMed" in browser.title

elem = browser.find_element_by_id("term")
elem.send_keys(SearchTerm)
elem.send_keys(Keys.RETURN)

elem = browser.find_elements_by_xpath("//a[@name='EntrezSystem2.PEntrez.PubMed.Pubmed_ResultsPanel.Pubmed_DisplayBar.Display']")[2].click()
#wait = WebDriverWait(browser, 10)
#wait.until(EC.presence_of_element_located((By.XPATH, "//div/fieldset/ul/li/input[contains(@id='PublicationDate')]"))).click()
elem = browser.find_element_by_id('PublicationDate').click()

With this code, I get the 'Message: Element is not currently visible' error.
If I delete the comment tags in front of the wait containing lines (near the bottom), and use lines instead, it waits the designated 10 seconds and finally produces an error: 'raise TimeoutException(message, screen, stacktrace)' 
How are these values, which seem to be revealed via javascript, accessed?

A:

Adding an implicit wait and using a different xpath search seems to work fine for me.  Here's an example of first sorting by relevance and then by First Author.  I commented out the virtual display since I'm on windows.
Give the following a try.
from selenium import webdriver
# from pyvirtualdisplay import Display
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

SearchTerm = raw_input("Enter search terms: ")
# display = Display(visible=0, size=(1024, 768))
# display.start()
browser = webdriver.Firefox()
browser.get("http://www.ncbi.nlm.nih.gov/pubmed/")
assert "PubMed" in browser.title

browser.implicitly_wait(10)

elem = browser.find_element_by_id("term")
elem.send_keys(SearchTerm)
elem.send_keys(Keys.RETURN)

elem = browser.find_elements_by_xpath("//a[starts-with(text(),'Sort by')]")[0].click()
elem = browser.find_elements_by_xpath("//label[contains(text(),'Relevance')]")[0].click()

elem = browser.find_elements_by_xpath("//a[starts-with(text(),'Sort by')]")[0].click()
elem = browser.find_elements_by_xpath("//label[contains(text(),'First Author')]")[0].click()

