Skip to main content

Semantic Locators are a human readable, resilient and accessibility-enforcing way to find web elements. This package adds semantic locator support to webdriver

Project description

Semantic Locators in Python WebDriver

Semantic locators can be used with Selenium WebDriver in a similar way to ByXPath or ByCssSelector. Currently only available for Python 3.6+.

Install from PyPi:

python -m pip install semantic-locators

Once installed, use Semantic Locators as follows:

from semantic_locators import (
    find_element_by_semantic_locator,
    find_elements_by_semantic_locator,
    closest_precise_locator_for,
)
...

search_button = find_element_by_semantic_locator(driver, "{button 'Google search'}")
all_buttons = find_elements_by_semantic_locator(driver, "{button}")

generated = closest_precise_locator_for(search_button); # {button 'Google search'}

General Semantic Locator documentation can be found on GitHub.

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

semantic-locators-2.1.0.tar.gz (19.4 kB view hashes)

Uploaded Source

Built Distribution

semantic_locators-2.1.0-py3-none-any.whl (19.7 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