Skip to content

unexpected Value Error . #798

Closed
Closed

Description

@petetpant1

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.

Activity

  1. aaltat commented on Apr 25, 2017

    @aaltat
    Contributor

    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

  2. petetpant1 commented on Apr 25, 2017

    @petetpant1
    Author

    Thanks a lot for your answer. I will get back here to post the actual cause when i 'll work it out! :)

  3. aaltat commented on Apr 25, 2017

    @aaltat
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions