MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / click_active_element

Method click_active_element

seleniumbase/fixtures/base_case.py:2442–2485  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2440 self.click(selector, by=by, scroll=scroll)
2441
2442 def click_active_element(self):
2443 if self.__is_cdp_swap_needed():
2444 self.cdp.click_active_element()
2445 return
2446 self.wait_for_ready_state_complete()
2447 pre_action_url = None
2448 with suppress(Exception):
2449 pre_action_url = self.driver.current_url
2450 pre_window_count = len(self.driver.window_handles)
2451 if self.recorder_mode:
2452 selector = js_utils.get_active_element_css(self.driver)
2453 self.click(selector)
2454 return
2455 else:
2456 self.execute_script("document.activeElement.click();")
2457 latest_window_count = len(self.driver.window_handles)
2458 if (
2459 latest_window_count > pre_window_count
2460 and (
2461 self.recorder_mode
2462 or (
2463 settings.SWITCH_TO_NEW_TABS_ON_CLICK
2464 and self.driver.current_url == pre_action_url
2465 )
2466 )
2467 ):
2468 self.__switch_to_newest_window_if_not_blank()
2469 if settings.WAIT_FOR_RSC_ON_CLICKS:
2470 self.wait_for_ready_state_complete()
2471 else:
2472 # A smaller subset of self.wait_for_ready_state_complete()
2473 self.wait_for_angularjs(timeout=settings.MINI_TIMEOUT)
2474 if self.driver.current_url != pre_action_url:
2475 self.__ad_block_as_needed()
2476 self.__disable_beforeunload_as_needed()
2477 if self.demo_mode:
2478 if self.driver.current_url != pre_action_url:
2479 if not js_utils.is_jquery_activated(self.driver):
2480 js_utils.add_js_link(self.driver, constants.JQuery.MIN_JS)
2481 self.__demo_mode_pause_if_active()
2482 else:
2483 self.__demo_mode_pause_if_active(tiny=True)
2484 elif self.slow_mode:
2485 self.__slow_mode_pause_if_active()
2486
2487 def click_with_offset(
2488 self,

Callers 2

add_textMethod · 0.95
click_active_elementFunction · 0.45

Calls 12

__is_cdp_swap_neededMethod · 0.95
clickMethod · 0.95
execute_scriptMethod · 0.95
wait_for_angularjsMethod · 0.95
__ad_block_as_neededMethod · 0.95
add_js_linkMethod · 0.80

Tested by

no test coverage detected