Calculates the absolute screen coordinates of any Selenium element so that you can click on them with every basic automation tool
# Tested with:
# https://github.com/ultrafunkamsterdam/undetected-chromedriver
# Python 3.9.13
# Windows 10
$pip install a-selenium-absolute-screencoords
You need only those 2 functions:
abscoord = get_absolute_screen_coords_of_element(
driver,x,y,)
coords_clicker.left_click_xy_natural(*abscoord) # Has more options, check it out: https://github.com/hansalemaos/mousekey
# Here is an example:
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from a_selenium2df import get_df
from selenium.webdriver.common.by import By
from a_selenium_kill import add_kill_selenium
from time import sleep
from auto_download_undetected_chromedriver import download_undetected_chromedriver
import undetected_chromedriver as uc
from a_selenium_absolute_screencoords import (
get_absolute_screen_coords_of_element,
coords_clicker,
)
@add_kill_selenium # https://github.com/hansalemaos/a_selenium_kill
def get_driver():
folderchromedriver = "f:\\seleniumdriver2"
path = download_undetected_chromedriver(
folder_path_for_exe=folderchromedriver, undetected=True
) # https://github.com/hansalemaos/auto_download_undetected_chromedriver
driver = uc.Chrome(driver_executable_path=path)
return driver
if __name__ == "__main__":
folderchromedriver = "f:\\seleniumdriver3"
path = download_undetected_chromedriver(
folder_path_for_exe=folderchromedriver, undetected=True
)
driver = get_driver()
driver.get(
r"https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo"
)
sleep(2)
df = get_df(
driver,
By,
WebDriverWait,
expected_conditions,
queryselector="a",
with_methods=False,
) # https://github.com/hansalemaos/a_selenium2df
abscoord = get_absolute_screen_coords_of_element(
driver,
df.aa_offsetLeft.iloc[2] + df.aa_offsetWidth.iloc[2] // 2,
df.aa_offsetTop.iloc[2],
)
coords_clicker.left_click_xy_natural(*abscoord)
Metadata
Release files for a-selenium-absolute-screencoords 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a_selenium_absolute_screencoords-0.10.tar.gz | 4.4 kB | Without provenance | Details for a_selenium_absolute_screencoords-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a_selenium_absolute_screencoords-0.10-py3-none-any.whl | Python 3 | none | any | Details for a_selenium_absolute_screencoords-0.10-py3-none-any.whl |
Total release size: 10.7 kB
Release files / a_selenium_absolute_screencoords-0.10.tar.gz
| Download URL | a_selenium_absolute_screencoords-0.10.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1366dcf875b2a3f75d2ae59997baa30e099f645944cfad4fcb3d3bb66ad1e2c
|
|
BLAKE2b-256 checksum How to use checksums |
10a001e26cf271cfd1f9d823d6f32225998fa70e9f20b960349f384e4772e486
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / a_selenium_absolute_screencoords-0.10-py3-none-any.whl
| Download URL | a_selenium_absolute_screencoords-0.10-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8151a6392f6e7ca9a528914ed527f48a9b37857d6152d6046439fdb44e1c6f22
|
|
BLAKE2b-256 checksum How to use checksums |
29048e1d47ca3600537bc79de6cb0e942be1da2874a7cb75476cd1650c405016
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for a-selenium-absolute-screencoords 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.