You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In very rare cases when i run my tests around 1/20 retries of the same test i get a ValueError from the Selenium2library._element_find(locator,True,True) using as a locator an xpath. I search the xpath in the opened browser of the test that failed with inspect element feature and it is indeed there(visible,clickable etc...) .I have tried recursive calls of the _element_find but still can't locate the element and throws valueError exception.
Any ideas ?
Sorry But this is my first comment to an open project.I propably should have report it as a bug.
Your problem is quite typical one in the web applications. Sometimes it takes awhile for the web application to display the element in the page, sometimes the delay is in milliseconds and sometimes in minutes. Now if one does assert directly, it's very common situation that the assert to fall, sometimes often sometimes rarely, because of the above reason. And with those arguments the _element_find() is acting like an assert.
To fix your problem, you should poll that the element is in the page. Depending how your web application is build, looking to the Wait* keywords direction could solve your problems. But it also might be that you may need perform more complicated polling, like refresh the page or performing the navigation again. But this depends how your web application is build and therefore a single solution does not exist to the problem.
But the Selenium2Library private method is working as designed and therefore this is not a problem in the Selenium2Library. Instead it looks like problem how you have using the private method.
As a side note, using private methods is not good practice. Specially because next major release will refactor those methods: #770
Activity
aaltat commentedon Apr 25, 2017
Your problem is quite typical one in the web applications. Sometimes it takes awhile for the web application to display the element in the page, sometimes the delay is in milliseconds and sometimes in minutes. Now if one does assert directly, it's very common situation that the assert to fall, sometimes often sometimes rarely, because of the above reason. And with those arguments the
_element_find()is acting like an assert.To fix your problem, you should poll that the element is in the page. Depending how your web application is build, looking to the Wait* keywords direction could solve your problems. But it also might be that you may need perform more complicated polling, like refresh the page or performing the navigation again. But this depends how your web application is build and therefore a single solution does not exist to the problem.
But the Selenium2Library private method is working as designed and therefore this is not a problem in the Selenium2Library. Instead it looks like problem how you have using the private method.
As a side note, using private methods is not good practice. Specially because next major release will refactor those methods: #770
petetpant1 commentedon Apr 25, 2017
Thanks a lot for your answer. I will get back here to post the actual cause when i 'll work it out! :)
aaltat commentedon Apr 25, 2017
Happy hunting, but because this doesn't look like a Selenium2Library issue, I am closing the issue.
If you have an update, please feel free to post it in the issue.