MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / gui_click_with_offset

Method gui_click_with_offset

seleniumbase/core/sb_cdp.py:2132–2146  ·  view source on GitHub ↗

Click an element at an {X,Y}-offset location. {0,0} is the top-left corner of the element. If center==True, {0,0} becomes the center of the element. The timeframe is the time spent moving the mouse.

(
        self, selector, x, y, timeframe=0.27, center=False
    )

Source from the content-addressed store, hash-verified

2130 self.loop.run_until_complete(self.page.wait(0.2))
2131
2132 def gui_click_with_offset(
2133 self, selector, x, y, timeframe=0.27, center=False
2134 ):
2135 """Click an element at an {X,Y}-offset location.
2136 {0,0} is the top-left corner of the element.
2137 If center==True, {0,0} becomes the center of the element.
2138 The timeframe is the time spent moving the mouse."""
2139 if center:
2140 px, py = self.get_gui_element_center(selector)
2141 self.gui_click_x_y(px + x, py + y, timeframe=timeframe)
2142 else:
2143 element_rect = self.get_gui_element_rect(selector)
2144 px = element_rect["x"]
2145 py = element_rect["y"]
2146 self.gui_click_x_y(px + x, py + y, timeframe=timeframe)
2147
2148 def click_with_offset(self, selector, x, y, center=False, scroll=True):
2149 element = self.find_element(selector)

Callers

nothing calls this directly

Calls 3

gui_click_x_yMethod · 0.95
get_gui_element_rectMethod · 0.95

Tested by

no test coverage detected