Skip to main content

Grey Matter reduces the time it takes to get up and running with Selenium.

Project description

Grey Matter

Grey Matter reduces the time it takes to get up and running with Selenium.

Installation

Use pip to install greymatter as follows:

pip install greymatter

Usage (Examples)

Instantiating ChromeDriver

from greymatter import By, ChromeDriver, Keys

class Website(ChromeDriver):
    def __init__(self):
        super().__init__()

Finding WebElements

Arguments:

  • by — a selenium locator strategy
  • criteria — the search criteria to the locator strategy
foo = self.element_is_present(By.TAG_NAME, "input")
bar = self.element_is_clickable(By.XPATH, '//button[text()="bar"]')

Getting Field Values

Arguments:

  • field — the name of the field
@property
def email_address(self):
    return self.get_field_value("Email:")

Pressing Keys

Arguments:

  • key — a selenium Keys object
  • number_of_times — the number of times to press the key
self.press_key(Keys.TAB, 3)

Setting Field Values

Arguments:

  • field — the name of the field
  • value — the value to set the field to
    def login(self, username, password):
        self.set_field_value("Username:", "foo")
        self.set_field_value("Password:", "bar")

Exceptions

Selenium's ElementNotInteractable, StaleElementReference, and Timeout exceptions can be imported from thursday as follows:

from greymatter.exceptions import ElementNotInteractableException, StaleElementReferenceException, TimeoutException

License

GNU General Public License (v3 only)

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

greymatter-0.1a1.tar.gz (16.7 kB view hashes)

Uploaded Source

Built Distribution

greymatter-0.1a1-py3-none-any.whl (17.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