Helper functions for Selenium
Project description
selenium-assist
Python package for easy writing of Selenium scripts.
Implemented helper functions:
- connect_webdriver
- load_page
- wait_for_presence
- wait_for_visibility
- click_element
- send_keys
- hoover_over_element
- switch_to_iframe
- get_table_data
- get_element_text
- execute_script
install
pip install selenium-assist
usage
import time
import selenium_assist as sa
from selenium.webdriver.common.keys import Keys
import logging
# setup and silence loggers
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("selenium.webdriver.remote.remote_connection").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
# connect webdriver (use False for headless mode)
driver = sa.connect_webdriver(True)
# do stuff
sa.load_page("Loading initial webpage ...", "https://google.com/ncr", driver)
sa.wait_for_presence("Waiting for Accept all ...", '//*[@id="L2AGLb"]', driver, extra_timeout=1)
sa.click_element("Clicking Accept all ...", '//*[@id="L2AGLb"]', driver)
sa.wait_for_presence("Waiting for Google Search ...", '//*[@id="APjFqb"]', driver)
sa.click_element("Clicking search box ...", '//*[@id="APjFqb"]', driver)
sa.send_keys("Sending text ...", '//*[@id="APjFqb"]', "news" + Keys.ENTER, driver, skip_check=True)
# close webdriver
logging.debug("Done with webdriver, sleeping 3s and exiting ...")
time.sleep(3)
driver.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
selenium_assist-0.3.5.tar.gz
(10.2 kB
view details)
Built Distribution
File details
Details for the file selenium_assist-0.3.5.tar.gz
.
File metadata
- Download URL: selenium_assist-0.3.5.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43c9e52b15c1e880178cd39d7203c58668166e0aed866bf8fc67a414d91a6f8 |
|
MD5 | 3d23f127fee9fb79d6b2ef923724c777 |
|
BLAKE2b-256 | 67723aaac91cb67d628d7a4ad51b4f3dcdb5531c017fad09a6c7e4693ae683c4 |
File details
Details for the file selenium_assist-0.3.5-py3-none-any.whl
.
File metadata
- Download URL: selenium_assist-0.3.5-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae58e1b8a4ab7e750e5302bbb0d3661b745e9d6f20dfafc5ace91572028ae762 |
|
MD5 | 283f9e8c8ea0b2b2c4d7459b0c43b99c |
|
BLAKE2b-256 | b7c6876033383a9c43b146182b72e99145bea87fa6052cd4f44b471a346a40db |