@@ -36,7 +36,7 @@ def __init__(self, page: Page):
3636 self .organisations_page = self .page .get_by_role ("link" , name = "Organisations" )
3737 self .reports_page = self .page .get_by_role ("link" , name = "Reports" )
3838 self .screening_practitioner_appointments_page = self .page .get_by_role (
39- "link" , name = "Screening Practitioner"
39+ "link" , name = "Screening Practitioner Appointments "
4040 )
4141 self .screening_subject_search_page = self .page .get_by_role (
4242 "link" , name = "Screening Subject Search"
@@ -51,10 +51,7 @@ def __init__(self, page: Page):
5151 self .main_menu__header = self .page .locator ("#ntshPageTitle" )
5252
5353 def click_main_menu_link (self ) -> None :
54- for _ in range (3 ): # Try up to 3 times
55- if self .main_menu_link .is_visible ():
56- self .click (self .main_menu_link )
57- return # Exit if successful
54+ self .click (self .main_menu_link )
5855
5956 def click_log_out_link (self ) -> None :
6057 self .click (self .log_out_link )
@@ -144,15 +141,22 @@ def go_to_screening_subject_search_page(self) -> None:
144141 self .click (self .screening_subject_search_page )
145142
146143 def click (self , locator : Locator ) -> None :
144+ # Alerts table locator
145+ alerts_table = locator .get_by_role ("table" , name = "cockpitalertbox" )
147146 """
148147 This is used to click on a locator
149148 The reason for this being used over the normal playwright click method is due to:
150149 - BCSS sometimes takes a while to render and so the normal click function 'clicks' on a locator before its available
151150 - Increases the reliability of clicks to avoid issues with the normal click method
152151 """
152+ if alerts_table .is_visible ():
153+ alerts_table .wait_for (state = "attached" )
154+ alerts_table .wait_for (state = "visible" )
155+
153156 try :
154157 self .page .wait_for_load_state ("load" )
155158 self .page .wait_for_load_state ("domcontentloaded" )
159+ self .page .wait_for_load_state ("networkidle" )
156160 locator .wait_for (state = "attached" )
157161 locator .wait_for (state = "visible" )
158162 locator .click ()
0 commit comments