SeleniumLibrary
SeleniumLibrary copied to clipboard
Add keywords for dealing with stale elements
For my use case it would be nice to have some keywords to be able to deal with elements that get removed from the DOM. Something along the lines of
Wait Until Element Is StaleGet Element StalenessElement Should (Not) Be Stale
I wrote a rudimentary Python plugin at work using Selenium's staleness_of condition. I got the OK to use the plugin as a base and spend some time so I'd be willing to try and provide a PR as well if this feature makes sense and would be a good fit for the library.
I know personally I have been hesitant to add an exhaustive set of keywords which specifically wait until some state. I was just now talking with Tatu about a question someone raised about waiting. He showed me this solution
element = WebDriverWait(self.driver, 30, ignored_exceptions=(StaleElementReferenceException,)).until(
EC.element_to_be_clickable((By.ID, "description"))
)
I was thinking a generic Wait until Element State Is/Is Not might be the solution. There is an full list of expected conditions that we could take advantage of .. I was just going to put in a reminder ticket for myself and saw your request. Do you think this (with a Get Element State and Element State Should (Not) Be keywords) fulfill your request?
Yeah that would be great!