@@ -163,12 +163,17 @@ def _get_import_dialog(self):
163163 versions or modalType='alert' use 'alertdialog'.
164164 """
165165 dialog = self .page .get_by_role ("dialog" , name = "Import Content" )
166- if dialog .count () > 0 :
167- return dialog .first
168166 alertdialog = self .page .get_by_role ("alertdialog" , name = "Import Content" )
169- if alertdialog .count () > 0 :
170- return alertdialog .first
171- raise Exception ("Import Content dialog not found with role 'dialog' or 'alertdialog'" )
167+ import_dialog = dialog .or_ (alertdialog ).first
168+
169+ try :
170+ expect (import_dialog ).to_be_visible (timeout = 5000 )
171+ except Exception as exc :
172+ raise Exception (
173+ "Import Content dialog not found with role 'dialog' or 'alertdialog'"
174+ ) from exc
175+
176+ return import_dialog
172177
173178 def select_schema_for_file (self , file_name , schema_name ):
174179 """
@@ -832,7 +837,9 @@ def validate_import_without_collection(self):
832837 validation_msg = self .page .locator (
833838 "//div[contains(text(),'Please Select') or contains(text(),'Please select')]"
834839 )
835- dialog = self .page .get_by_role ("dialog" ).or_ (self .page .get_by_role ("alertdialog" ))
840+ dialog = self .page .get_by_role ("dialog" , name = "Import Content" ).or_ (
841+ self .page .get_by_role ("alertdialog" , name = "Import Content" )
842+ )
836843
837844 if validation_msg .count () > 0 and validation_msg .first .is_visible ():
838845 logger .info ("✓ Validation message is visible" )
0 commit comments