If the code paths are correct, the location element does not exist
dri.find_element(By.XPATH,'//*[@id="submitButton"]/span').click() sleep(2) dri.find_element(By.XPATH,"//span[contains(text(),'button')]").click() # sleep(2) #Be sure to do the wait, otherwise the response is too fast for the browser to keep up dri.find_element(By.XPATH,"//li[contains(text(),'Dropdown box')]").click()