Skip to content

ch11l032 - Typo in the test / issue with wait_for + truthiness #116

Description

@HelloThisIsFlo

In ch11l032, this is introduced, to test the HTML5 validation:

self.wait_for(lambda: self.browser.find_elements_by_css_selector(
 '#id_text:invalid'
 ))

However, it isn't testing anything.

Because we are using find_elementS_by_css_selector(...) if the element is not found an empty list will be returned and no exception will be raised. Therefore our wait_for immediately returns after the first try and we didn't test anything (try making it fail on purpose by looking for a different id, it won't fail).

To fix that, the solution is simple, remove the S. That way it'll either find that one element, or raise a NoSuchElementException, which is a WebDriverException, so our wait_for works as expected 🙂

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions