9 examples of 'selenium move mouse to element' in Python

Every line of 'selenium move mouse to element' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
190def double_click_element_at_position(self, element, x, y):
191 actions = ActionChains(self._driver)
192 actions.move_to_element_with_offset(element, x, y)
193 actions.click()
194 actions.click()
195 actions.perform()
95def mouseMove(self, x, y):
96
97 # We should never be trying to draw outside the canvas area
98 assert x >= 0
99 assert y - self.offsetY >= 0
100 assert x <= self.getW()
101 assert y - self.offsetY <= self.region.getH()
102
103 self.region.mouseMove(Location(self.region.getX() + x, self.region.getY() + y - self.offsetY))
754def perform_action_chain_move_by_offset(self, x=0, y=0):
755 """Moving the mouse to an offset from current mouse position
756
757 :param x: X offset to move to
758 :param y: Y offset to move to
759
760 """
761 ActionChains(self.browser).move_by_offset(x, y).perform()
762 self.wait_for_ajax()
205def mouseover_element(self, element_selector):
206 chain = ActionChains(self.webdriver)
207 chain.move_to_element(self._get_element(element_selector))
208 chain.perform()
145def hover_element_and_click(driver, element, click_selector,
146 click_by=By.CSS_SELECTOR,
147 timeout=settings.SMALL_TIMEOUT):
148 """
149 Similar to hover_and_click(), but assumes top element is already found.
150 """
151 start_ms = time.time() * 1000.0
152 stop_ms = start_ms + (timeout * 1000.0)
153 hover = ActionChains(driver).move_to_element(element)
154 hover.perform()
155 for x in range(int(timeout * 10)):
156 try:
157 element = driver.find_element(by=click_by, value=click_selector)
158 element.click()
159 return element
160 except Exception:
161 now_ms = time.time() * 1000.0
162 if now_ms >= stop_ms:
163 break
164 time.sleep(0.1)
165 raise NoSuchElementException(
166 "Element {%s} was not present after %s seconds!" %
167 (click_selector, timeout))
53def tap_and_hold(self, xcoord, ycoord):
54 """
55 Touch down at given coordinates.
56
57 :Args:
58 - xcoord: X Coordinate to touch down.
59 - ycoord: Y Coordinate to touch down.
60 """
61 self._actions.append(lambda:
62 self._driver.execute(Command.TOUCH_DOWN, {
63 'x': int(xcoord),
64 'y': int(ycoord)}))
65 return self
85def move_to(self, x=0, y=0):
86 self._first.move_to(x, y)
87 return self
109def _double_click(self, locator, dont_wait='', coordinates=None):
110 self._click_or_click_at(locator, self._selenium.double_click,
111 self._selenium.double_click_at, coordinates,
112 dont_wait)
484def scroll_to(self, x, y):
485 """
486 Scroll to a particular (x, y) coordinate.
487
488 :param x: the x coordinate to scroll to.
489 :type x: int
490 :param y: the y coordinate to scroll to.
491 :type y: int
492 :return:
493 """
494 # prevent script injection
495 x = int(x)
496 y = int(y)
497 self.execute_script('window.scrollTo({}, {});'.format(x, y))

Related snippets