SeleniumLibrary
SeleniumLibrary copied to clipboard
How we can deal with stale element reference with selenium libray?We need a keyword to deal with stale element reference
Prerequisites
- I have searched for similar issues in open tickets and cannot find a duplicate.
- The issue still exists against the latest released version of SeleniumLibrary.
- This is not a usage question or support request. For those, see more details in README.rst: https://github.com/robotframework/SeleniumLibrary#support
- You are not using the Java Selenium2Library: https://github.com/MarketSquare/robotframework-seleniumlibrary-java
- Remember that this is a public forum, so remember to remove all sensitive information, like username and password.
For issues
Steps to reproduce the issue
Create a simplified example which reproduces the problem. It is good if the example can be run also by us, but this is not always mandatory.
Error messages and additional information
If there is an error, run the test with --loglevel trace set from command line
and copy paste the full stack trace to the issue. Use https://gist.github.com/ or
similar service for anything that longer than few lines.
Provide other details which might be useful for investigating the issue. Screenshots from application or from unexpected dialogues are example useful. Sometimes showing relevant parts of the log.html is useful too.
Expected behavior and actual behavior
When I follow those steps, I see...
I was expecting...
Environment
Browser: Name and version (Usually available from the about dialogue.) Browser driver: Name and version Operating System: Name and version (Linux, Ubuntu 18.04) Libraries
- Robot Framework: Version
- Selenium: Version
- SeleniumLibrary: Version
- Interpreter: Name and version
Feature requests
Describe the need or the feature you are missing from the SeleniumLibrary. Also it is useful to understand why you need such feature. Many times, it is useful to provide few examples for acceptance tests. Try to avoid technical or implementation details, those will handled later.
This project is not funded by any organisation or company, I do this because I want to do this on my own free time. Therefore if you want feature be implemented, the easiest and usually fastest way usually is to provide pull request. See https://github.com/robotframework/SeleniumLibrary/blob/master/CONTRIBUTING.rst for mode details about project development.
Could you expand upon what you are looking for you you say "We need a keyword to deal with stale element reference"? I am not sure what types of requirements you are looking for.
Duplicate of #1767
In the meantime, you can use and extend a SeleniumLibrary plugin like this to handle stale elements.
Every Wait * keyword has automatic suppression of stale element reference exception, which was very much debated when I did made the change.
In my opinion it is wrong to suppress the stale element reference exception in assertion type of keywords, like Click Element because exception is an indication of failure. Also retry will, most likely, lead to different type of problems. Instead users should invents in SUT testability and find a way to ask from the application when it is ready to receive the action. One way is using the https://pypi.org/project/robotframework-seleniumtestability/ but other also exist.