From 367f95fd7afde7e207d9221988c55dae5fc8f323 Mon Sep 17 00:00:00 2001 From: amol patil Date: Mon, 10 Feb 2025 19:24:50 +0530 Subject: [PATCH] update id locator in widgets --- airgun/widgets.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/airgun/widgets.py b/airgun/widgets.py index 175c00132..6bff2ea6c 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -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):