Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HelloThisIsFlo opened this issue Nov 14, 2019 · 1 comment
Open

Comments

@HelloThisIsFlo
Copy link

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 🙂

@hjwp
Copy link
Owner

hjwp commented Jul 8, 2024

hmmm. yes i think in past versions of wait_for(), it would also wait for the result to be Truthy. might look at changing that. thanks so much!

@hjwp hjwp changed the title ch11l032 - Typo in the test ch11l032 - Typo in the test / issue with wait_for + truthiness Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants