Skip to main content

Helper functions for Selenium

Project description

selenium-assist

PyPI PyPI - License Code style: black

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


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.6.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

selenium_assist-0.3.6-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file selenium_assist-0.3.6.tar.gz.

File metadata

  • Download URL: selenium_assist-0.3.6.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for selenium_assist-0.3.6.tar.gz
Algorithm Hash digest
SHA256 438912c9ac5639ef137ff47b3e2d5e6bff029e8b6f9a4c3698926df04b86d142
MD5 ebf7783f6a5c63cc9b1ba9144273f6e8
BLAKE2b-256 3ab78fc5e6b3b47cbff0bc7e2b37deef9dc5ab4f4940c50aee03273f30674547

See more details on using hashes here.

File details

Details for the file selenium_assist-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for selenium_assist-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 73cc7560cb7bef900704952a58c76143cfd5ff4823e46d457fe73ff5b20fd8c9
MD5 4f93e35a72af02231ef713ab10a4b250
BLAKE2b-256 76ba2d0439a429c94387404ad72f7af665445e389da3b9151a39fbcbb68b47d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page