Python Forum
TDD/CSS & HTML testing - CSS selector (.has-error) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: TDD/CSS & HTML testing - CSS selector (.has-error) (/thread-26785.html)



TDD/CSS & HTML testing - CSS selector (.has-error) - makoseafox - May-13-2020

Hello everyone - I am doing TDD book, so I got stuck at this point for a while when I was trying to get functional test to pass. But I couldnt. Here's my ongoing error below:

Error:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: .has-error
Related code between my template/selenium:

self.wait_for(lambda: self.assertEqual(self.browser.find_element_by_css_selector('.has-error').text,
            "You can't have an empty list item"))
[html]. <div class="form-group has-error">
<span class="help-block">{{ error }}</span>
</div>
{% endif %}. [/html]

Your help would be so much appreciated!