From ec8126d5beec9cd4839eb4276ce64faaebf50387 Mon Sep 17 00:00:00 2001 From: amol patil Date: Mon, 10 Feb 2025 19:24:50 +0530 Subject: [PATCH] update FilteredDropdown locator in widgets --- airgun/views/host.py | 2 +- airgun/widgets.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/airgun/views/host.py b/airgun/views/host.py index dc05cfaa3..6f1c93e42 100644 --- a/airgun/views/host.py +++ b/airgun/views/host.py @@ -377,7 +377,7 @@ class operating_system(SatTab): architecture = FilteredDropdown(id='s2id_host_architecture_id') operating_system = FilteredDropdown(id='s2id_host_operatingsystem_id') - image = FilteredDropdown(id='s2id_azure_rm_image_id') + image = FilteredDropdown(id='azure_rm_image_id') root_password = TextInput(id='host_root_pass') @View.nested diff --git a/airgun/widgets.py b/airgun/widgets.py index 175c00132..2f2139ef0 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -1155,19 +1155,21 @@ class FilteredDropdown(GenericLocatorWidget): """ - selected_value = Text("./a/span[contains(@class, 'chosen')]") - open_filter = Text("./a/span[contains(@class, 'arrow')]") + selected_value = Text("./ancestor::div[1]//span/span[contains(@class, 'rendered')]") + 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):