Skip to main content

A couple of useful JS scripts for Selenium

Project description

A couple of useful JS scripts for Selenium

# 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/
    
	

Project details


Release history Release notifications | RSS feed

This version

0.10

Download files

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

Source Distribution

a_selenium_some_js-0.10.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

a_selenium_some_js-0.10-py3-none-any.whl (5.8 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