a-selenium-absolute-screencoords


Namea-selenium-absolute-screencoords JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/a_selenium_absolute_screencoords
SummaryCalculates the absolute screen coordinates of any Selenium element so that you can click on them with every basic automation tool
upload_time2023-01-01 16:16:34
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords selenium click interact
VCS
bugtrack_url
requirements ctypes_window_info mousekey
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Calculates the absolute screen coordinates of any Selenium element so that you can click on them with every basic automation tool

```python
# 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)
	
```





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/a_selenium_absolute_screencoords",
    "name": "a-selenium-absolute-screencoords",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Selenium,click,interact",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/10/a0/01e26cf271cfd1f9d823d6f32225998fa70e9f20b960349f384e4772e486/a_selenium_absolute_screencoords-0.10.tar.gz",
    "platform": null,
    "description": "\n# Calculates the absolute screen coordinates of any Selenium element so that you can click on them with every basic automation tool\n\n```python\n# Tested with:\n# https://github.com/ultrafunkamsterdam/undetected-chromedriver\n# Python 3.9.13\n# Windows 10\n\n$pip install a-selenium-absolute-screencoords\n\nYou need only those 2 functions:\nabscoord = get_absolute_screen_coords_of_element(\n    driver,x,y,)\ncoords_clicker.left_click_xy_natural(*abscoord) # Has more options, check it out: https://github.com/hansalemaos/mousekey\n\n\n# Here is an example:\n\nfrom selenium.webdriver.support import expected_conditions\nfrom selenium.webdriver.support.wait import WebDriverWait\nfrom a_selenium2df import get_df\nfrom selenium.webdriver.common.by import By\nfrom a_selenium_kill import add_kill_selenium\nfrom time import sleep\nfrom auto_download_undetected_chromedriver import download_undetected_chromedriver\nimport undetected_chromedriver as uc\nfrom a_selenium_absolute_screencoords import (\n    get_absolute_screen_coords_of_element,\n    coords_clicker,\n)\n\n\n@add_kill_selenium  # https://github.com/hansalemaos/a_selenium_kill\ndef get_driver():\n    folderchromedriver = \"f:\\\\seleniumdriver2\"\n    path = download_undetected_chromedriver(\n        folder_path_for_exe=folderchromedriver, undetected=True\n    )  # https://github.com/hansalemaos/auto_download_undetected_chromedriver\n    driver = uc.Chrome(driver_executable_path=path)\n    return driver\n\n\nif __name__ == \"__main__\":\n    folderchromedriver = \"f:\\\\seleniumdriver3\"\n    path = download_undetected_chromedriver(\n        folder_path_for_exe=folderchromedriver, undetected=True\n    )\n    driver = get_driver()\n    driver.get(\n        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\"\n    )\n    sleep(2)\n    df = get_df(\n        driver,\n        By,\n        WebDriverWait,\n        expected_conditions,\n        queryselector=\"a\",\n        with_methods=False,\n    )  # https://github.com/hansalemaos/a_selenium2df\n    abscoord = get_absolute_screen_coords_of_element(\n        driver,\n        df.aa_offsetLeft.iloc[2] + df.aa_offsetWidth.iloc[2] // 2,\n        df.aa_offsetTop.iloc[2],\n    )\n    coords_clicker.left_click_xy_natural(*abscoord)\n\t\n```\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Calculates the absolute screen coordinates of any Selenium element so that you can click on them with every basic automation tool",
    "version": "0.10",
    "split_keywords": [
        "selenium",
        "click",
        "interact"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "d398a3f298d8d5dd23f3d7ec7aa87e41",
                "sha256": "8151a6392f6e7ca9a528914ed527f48a9b37857d6152d6046439fdb44e1c6f22"
            },
            "downloads": -1,
            "filename": "a_selenium_absolute_screencoords-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d398a3f298d8d5dd23f3d7ec7aa87e41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6379,
            "upload_time": "2023-01-01T16:16:33",
            "upload_time_iso_8601": "2023-01-01T16:16:33.224515Z",
            "url": "https://files.pythonhosted.org/packages/29/04/8e1d47ca3600537bc79de6cb0e942be1da2874a7cb75476cd1650c405016/a_selenium_absolute_screencoords-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "beb7758495285dbac314ab0c392a3b76",
                "sha256": "b1366dcf875b2a3f75d2ae59997baa30e099f645944cfad4fcb3d3bb66ad1e2c"
            },
            "downloads": -1,
            "filename": "a_selenium_absolute_screencoords-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "beb7758495285dbac314ab0c392a3b76",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4360,
            "upload_time": "2023-01-01T16:16:34",
            "upload_time_iso_8601": "2023-01-01T16:16:34.532945Z",
            "url": "https://files.pythonhosted.org/packages/10/a0/01e26cf271cfd1f9d823d6f32225998fa70e9f20b960349f384e4772e486/a_selenium_absolute_screencoords-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-01 16:16:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "a_selenium_absolute_screencoords",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "ctypes_window_info",
            "specs": []
        },
        {
            "name": "mousekey",
            "specs": []
        }
    ],
    "lcname": "a-selenium-absolute-screencoords"
}
        
Elapsed time: 0.07001s