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 details)

Uploaded Source

File details

Details for the file glance_dom-0.11.5.tar.gz.

File metadata

  • Download URL: glance_dom-0.11.5.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for glance_dom-0.11.5.tar.gz
Algorithm Hash digest
SHA256 5bb2d7775ae473e59808be2cd6e6a94597b36e002696ee46084cd72f95d17440
MD5 80a53f3b921150e499c189811555f83b
BLAKE2b-256 11f235c28906e53a138547f6820a9b36b300e545d194f32b14a4a346c3153e28

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