# A couple of useful JS scripts for Selenium
```python
# Tested with:
# https://github.com/ultrafunkamsterdam/undetected-chromedriver
# Python 3.9.13
# Windows 10
$pip install a-selenium-some-js
from a_selenium_some_js import *
execute_scripts_with_timeout(
driver, script=f"window.scrollBy(0,{200})", script_timeout=3
)
js_scrollby(driver, y=40, script_timeout=0)
go_to_top_of_page(driver, script_timeout=1)
get_navigator_infos(driver)
zoom_website(driver, scaleFactor=2, x=0, y=0, relativeSpeed=800)
maximize_window(driver) # window is not maximized, but its size is like maximized
send_cmd(driver,'Input.synthesizePinchGesture', {
'x': 0,
'y': 0,
'scaleFactor': 2,
'relativeSpeed': 800, # optional
'gestureSourceType': 'default' # optional
}) # https://chromedevtools.github.io/devtools-protocol/
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/a_selenium_some_js",
"name": "a-selenium-some-js",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Selenium,js,scripts",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c4/85/f29912f03b8d58076f78803ce750c976ba4660de03cbd23b6c2b6ccef965/a_selenium_some_js-0.10.tar.gz",
"platform": null,
"description": "\n# A couple of useful JS scripts for Selenium\n\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-some-js\n\nfrom a_selenium_some_js import *\n\nexecute_scripts_with_timeout(\n driver, script=f\"window.scrollBy(0,{200})\", script_timeout=3\n )\njs_scrollby(driver, y=40, script_timeout=0)\t\ngo_to_top_of_page(driver, script_timeout=1)\nget_navigator_infos(driver)\nzoom_website(driver, scaleFactor=2, x=0, y=0, relativeSpeed=800)\n\nmaximize_window(driver) # window is not maximized, but its size is like maximized\n\nsend_cmd(driver,'Input.synthesizePinchGesture', {\n 'x': 0,\n 'y': 0,\n 'scaleFactor': 2,\n 'relativeSpeed': 800, # optional\n 'gestureSourceType': 'default' # optional\n }) # https://chromedevtools.github.io/devtools-protocol/\n \n\t\n```\n\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A couple of useful JS scripts for Selenium",
"version": "0.10",
"split_keywords": [
"selenium",
"js",
"scripts"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "077357c32da1d659f0aeae02aef1a79f",
"sha256": "67c49e9e184a2e25510405885a512ce8472effe5d85ebdf26cc029ba970f9f59"
},
"downloads": -1,
"filename": "a_selenium_some_js-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "077357c32da1d659f0aeae02aef1a79f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5776,
"upload_time": "2023-01-01T21:20:57",
"upload_time_iso_8601": "2023-01-01T21:20:57.634484Z",
"url": "https://files.pythonhosted.org/packages/cd/26/0f362a9e1aff3a03cf99a30d4a57b4a420dd05c3f7bbc0a6ec434e81ca20/a_selenium_some_js-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "451e3f2bcdcc3c3bd1e1d5930c0648e3",
"sha256": "e648b9130bec39ee80a315e03f85dedf3bc08c4db804242597aef94523f6d078"
},
"downloads": -1,
"filename": "a_selenium_some_js-0.10.tar.gz",
"has_sig": false,
"md5_digest": "451e3f2bcdcc3c3bd1e1d5930c0648e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4077,
"upload_time": "2023-01-01T21:20:59",
"upload_time_iso_8601": "2023-01-01T21:20:59.142095Z",
"url": "https://files.pythonhosted.org/packages/c4/85/f29912f03b8d58076f78803ce750c976ba4660de03cbd23b6c2b6ccef965/a_selenium_some_js-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-01 21:20:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "a_selenium_some_js",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "a-selenium-some-js"
}