Skip to main content

Move mouse cursor to element in browser

Project description

SeleniumMoveCursor

Moving cursor to element in browser run by selenium webdriver. Currently works for chrome browser, maximized. Method to use is move_to_element_chrome.

#Preconditions

  • Chrome is run by selenium webdriver and is maximized
  • Chrome infobar is disabled. Python code to achieve this:

from selenium import webdriver

chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--disable-infobars") driver = webdriver.Chrome(chrome_options=chrome_options)

  • Web element is visible on browser (scroll is done before calling method move_to_element_chrome)
  • Display scaling (100, 125, 150 or 175 %) need to be given when calling method move_to_element_chrome. This info can be found in display settings.

#How to use method for moving cursor to web element (move_to_element_chrome):

from selenium import webdriver from selenium_move_cursor.MouseActions import move_to_element_chrome

chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--disable-infobars") driver = webdriver.Chrome(chrome_options=chrome_options)

driver.maximize_window()

driver.get("https://www.google.com/") element = driver.find_elements_by_css_selector("input[class='gNO89b']")[1]

move_to_element_chrome(driver, element, 125)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selenium-move-cursor-0.0.5.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

selenium_move_cursor-0.0.5-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page