Replace get_select_option with Selenium's native select_by_value
We have our own method called django.contrib.admin.tests.AdminSeleniumTestCase.get_select_option
which does the very same thing as selenium.webdriver.support.select.Select.select_by_value
.
We could replace it with something like:
def select_option(self, select_tag_css_selector, value):
from selenium.webdriver.support.ui import Select
select = Select(self.selenium.find_element_by_css_selector(select_tag_css_selector))
select.select_by_value(value)
This would avoid looping over the DOM-tree as it's done in the current implementation.
Furthermore, it can avoid errors when a select-tag is outside the current viewport.
Change History
(7)
Patch needs improvement: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
Keywords: |
Selenium added
|
Summary: |
Replace get_select_option with native select_by_value → Replace get_select_option with Selenium's native select_by_value
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
OK. Sounds good. — Thanks again! (Will review all three tickets next week.)