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.

Source Distribution

glance_dom-0.11.5.tar.gz (11.2 kB view hashes)

Uploaded Source

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