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_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


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.4.tar.gz (8.0 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.4-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: selenium_assist-0.3.4.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for selenium_assist-0.3.4.tar.gz
Algorithm Hash digest
SHA256 fc03095ce16ab307f9388a8365e380db9365f86c9d6fd8d6d0183626382d5a86
MD5 5a8b171399b75a7549879db19cc2ac8a
BLAKE2b-256 19c6fe7500310dc9fb3a3b08e36b437a51be61e6433ab30f1a9aa6a0ef963fa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for selenium_assist-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a8c4dfad6b7f91e767702c9415ac9f352d89e1e3a76b7bece508af1971ac1808
MD5 d9c952554526a9b1865b4aed42edd504
BLAKE2b-256 860adfe3c9c9dd60ac6d2a3991774d760b510f97710422c823d4e40193237b30

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