Skip to main content

Quickly reference DOM elements with minimal inspection.

Project description

Quickly reference DOM elements with minimal inspection.

To learn more about Glance DOM visit the Glance Website.

Installation

Installation requires pip:

pip install glance-dom

Usage

Instantiate Glance DOM using a browser driver (for example, WebDriver).

from selenium import webdriver
from glance_dom import GlanceDom

def test_glance():
    driver = webdriver.Firefox()
    driver.get('http://quasimatic.org/glance')

    # Using the old way
    languages = driver.find_element_by_css_selector('h2#other-languages + ul > li')

    # Using Glance
    glance = GlanceDom(driver)
    languages = glance.get_element('Other Languages > li')

    print(languages.text)

You can also get a list of matching elements using get_elements

Exceptions

get_element will raise NoReferenceError if the reference did not match any elements. Similarly it will raise TooBroadReferenceError it there are more than one match.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for glance_dom, version 0.11.5
Filename, size File type Python version Upload date Hashes
Filename, size glance_dom-0.11.5.tar.gz (11.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page