About Testing Single-selection Autocomplete Fields with Selenium
Selenium allows testing not only the common input fields, but also autocomplete fields, such as this single-selection autocomplete field built with django-autocomplete-light.
For example, here's how you can start typing a country ("germ" for "Germany") and select the autocompleted option to complete the action:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Add some time.sleep(1)
calls between the actions to slow down the tests and be able to see what's going on visually.
Tips and Tricks Testing Django 5.x Django 4.2 Django 3.2 django-autocomplete-light Selenium
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.