@@ -163,19 +163,27 @@ def open_history_menu(self) -> BasePage:
163163 self .click_on ("panel-ui-history" )
164164 return self
165165
166- def select_clear_history_option (self , option : str ) -> BasePage :
166+ @BasePage .context_chrome
167+ def open_clear_history_dialog (self ) -> BasePage :
168+ """Opens the clear history dialog and switches to iframe context"""
169+ self .open_history_menu ()
170+ self .element_clickable ("clear-recent-history" )
171+ self .click_on ("clear-recent-history" )
172+
173+ self .element_visible ("iframe" )
174+ iframe = self .get_element ("iframe" )
175+ BrowserActions (self .driver ).switch_to_iframe_context (iframe )
176+ return self
177+
178+ @BasePage .context_content
179+ def select_history_time_range_option (self , option : str ) -> BasePage :
167180 """
168- Selects the clear history option, assumes the history panel is open.
181+ Selects time range option ( assumes already in iframe context)
169182 """
170- with self .driver .context (self .driver .CONTEXT_CHROME ):
171- self .get_element ("clear-recent-history" ).click ()
172- iframe = self .get_element ("iframe" )
173- BrowserActions (self .driver ).switch_to_iframe_context (iframe )
174-
175- with self .driver .context (self .driver .CONTEXT_CONTENT ):
176- dropdown_root = self .get_element ("clear-history-dropdown" )
177- dropdown = Dropdown (page = self , root = dropdown_root , require_shadow = False )
178- dropdown .select_option (option )
183+ dropdown_root = self .get_element ("clear-history-dropdown" )
184+ dropdown = Dropdown (page = self , root = dropdown_root , require_shadow = False )
185+ dropdown .select_option (option )
186+ return self
179187
180188 def get_all_history (self ) -> List [WebElement ]:
181189 """
@@ -269,20 +277,6 @@ def get_bookmark_tags(self, tags: List[str]) -> List[str]:
269277 for tag in tags
270278 ]
271279
272- @BasePage .context_chrome
273- def clear_recent_history (self , execute = True ) -> BasePage :
274- """Clears recent history. Case of execute=True may not be complete"""
275- self .open_panel_menu ()
276- self .get_element ("panel-ui-history" ).click ()
277-
278- self .element_exists ("clear-recent-history" )
279- self .element_visible ("clear-recent-history" )
280- self .element_clickable ("clear-recent-history" )
281- if execute :
282- self .click ("clear_recent_history" )
283-
284- return self
285-
286280 @BasePage .context_chrome
287281 def confirm_history_clear (self ):
288282 """Confirm that the history is empty"""
0 commit comments