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_presences
- wait_for_visibility
- click_element
- send_keys
- hoover_over_element
- switch_to_iframe
- get_table_data
- get_element_text
- get_elements_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.4.0.tar.gz
(10.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file selenium_assist-0.4.0.tar.gz.
File metadata
- Download URL: selenium_assist-0.4.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95a926964a14e3ceca291d12509973f4c1ffd94ce66a209a980ebf1b36302f92
|
|
| MD5 |
123ba1940d09474a315b13133c560351
|
|
| BLAKE2b-256 |
99f69900c7b559a213bc3f81b34a812a6f816f85f7aa9a03846b02ade9991a85
|
File details
Details for the file selenium_assist-0.4.0-py3-none-any.whl.
File metadata
- Download URL: selenium_assist-0.4.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bc23b8939351bf15da60c6179f5b75a269c6daae43da676bee9e1846dcc2c0a
|
|
| MD5 |
e415a09927edbf6df6428f2dad3078fa
|
|
| BLAKE2b-256 |
bb2dbbcdfd8ad5d14cee55d6b3a3ee07b14a705816f3d3fd8636df7dddf8db56
|