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

Method jquery_click

seleniumbase/fixtures/base_case.py:7222–7261  ·  view source on GitHub ↗

Clicks an element using jQuery. (Different from using pure JS.) Can be used to click hidden / invisible elements.

(self, selector, by="css selector", timeout=None)

Source from the content-addressed store, hash-verified

7220 )
7221
7222 def jquery_click(self, selector, by="css selector", timeout=None):
7223 """Clicks an element using jQuery. (Different from using pure JS.)
7224 Can be used to click hidden / invisible elements."""
7225 self.__check_scope()
7226 if not timeout or timeout is True:
7227 timeout = settings.SMALL_TIMEOUT
7228 if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
7229 timeout = self.__get_new_timeout(timeout)
7230 original_selector = selector
7231 selector, by = self.__recalculate_selector(selector, by, xp_ok=False)
7232 self.wait_for_element_present(selector, by=by, timeout=timeout)
7233 if self.is_element_visible(selector, by=by):
7234 self.__demo_mode_highlight_if_active(selector, by)
7235 selector = self.convert_to_css_selector(selector, by=by)
7236 css_selector = selector
7237 selector = self.__make_css_match_first_element_only(selector)
7238 click_script = """jQuery('%s')[0].click();""" % selector
7239 if (
7240 self.recorder_mode
7241 and self.__current_url_is_recordable()
7242 and self.get_session_storage_item("pause_recorder") == "no"
7243 ):
7244 time_stamp = self.execute_script("return Date.now();")
7245 tag_name = None
7246 href = ""
7247 if ":contains\\(" not in css_selector:
7248 tag_name = self.execute_script(
7249 "return document.querySelector('%s').tagName.toLowerCase()"
7250 ";" % css_selector
7251 )
7252 if tag_name == "a":
7253 href = self.execute_script(
7254 "return document.querySelector('%s').href;" % css_selector
7255 )
7256 origin = self.get_origin()
7257 href_origin = [href, origin]
7258 action = ["jq_cl", original_selector, href_origin, time_stamp]
7259 self.__extra_actions.append(action)
7260 self.safe_execute_script(click_script)
7261 self.__demo_mode_pause_if_active()
7262
7263 def jquery_click_all(self, selector, by="css selector", timeout=None):
7264 """Clicks all matching elements using jQuery."""

Callers 11

clickMethod · 0.95
jquery_clickFunction · 0.80
jquery_klikMethod · 0.80
jquery_cliquerMethod · 0.80
jquery_fare_clicMethod · 0.80
jquery_haga_clicMethod · 0.80
JQUERY_클릭Method · 0.80
JQUERY_нажмитеMethod · 0.80
JQUERY单击Method · 0.80
jquery_cliqueMethod · 0.80

Calls 14

__check_scopeMethod · 0.95
__get_new_timeoutMethod · 0.95
is_element_visibleMethod · 0.95
execute_scriptMethod · 0.95
get_originMethod · 0.95

Tested by

no test coverage detected