I understand why I would get this if I found an element, refreshed the
page, then tried to use the element. In this case, however, I'm
waiting for the page to load and then simply trying to get (but not
yet use) an element.
I'm using selenium-server-standalone-2.4.0.jar and the 2.4.0 python
bindings with python 2.7
Here's the relevant bits of my code:
driver = webdriver.Remote(
command_executor = SeHUB,
desired_capabilities = {
"browserName": "internet explorer",
}
)
driver.implicitly_wait(10)
driver.get(ROOT)
## proof that find_elements_by_tag_name isn't fundamentally
## busted
elements = driver.find_elements_by_tag_name("div")
print "elements", elements
## log in to the application
element = driver.find_element_by_id(USERNAME_FIELD)
element.send_keys(USERNAME)
element = driver.find_element_by_id(PASSWORD_FIELD)
element.send_keys(PASSWORD)
button = driver.find_element_by_id(LOGIN_BUTTON)
button.click()
## artificial time to wait for the page to load
time.sleep(5)
## same call as before, but this throws the exception
## StaleElementReferenceException
elements = driver.find_elements_by_tag_name("div")
print "elements", elements
driver.quit()
print "success!"
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.