Skip to content

Commit

Permalink
update id locator in widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 committed Feb 11, 2025
1 parent 6e73437 commit 367f95f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,18 +1156,20 @@ class FilteredDropdown(GenericLocatorWidget):
"""

selected_value = Text("./a/span[contains(@class, 'chosen')]")
open_filter = Text("./a/span[contains(@class, 'arrow')]")
open_filter = Text("./ancestor::div[1]//span/span[contains(@class, 'arrow')]")
clear_filter = Text("./a/abbr")
filter_criteria = TextInput(locator="//div[@id='select2-drop']//input")
filter_criteria = TextInput(
locator="//span[@class='select2-search select2-search--dropdown']//input"
)
filter_content = ItemsList(
"//div[not(contains(@style, 'display: none')) and @id='select2-drop']/ul"
"//span[not(contains(@style, 'display: none')) and @class='select2-results']/ul"
)

def __init__(self, parent, id=None, locator=None, logger=None):
"""Supports initialization via ``id=`` or ``locator=``"""
if (locator and id) or (not locator and not id):
raise ValueError('Please specify either locator or id')
locator = locator or f".//div[contains(@id, '{id}')]"
locator = locator or f".//select[contains(@id, '{id}')]"
super().__init__(parent, locator, logger)

def read(self):
Expand Down

0 comments on commit 367f95f

Please sign in to comment.