Skip to main content

Pythonic web testing

Project description

Bromine: pythonic web testing

Bromine is a wrapper around selenium to allow writing testing in a terse and pythonic rather that java-esque way.

Selenium is cool: you register browser to a hub, you ask browsers from a hub, you use the browser, and you put it back. It works like magic.

Except if you want to use https. But who needs https these days?

Anyway, enough dissing well intentioned web testing systems. Let's talk bad about bad testing system. You know what you have to do to wait for a page to load after a get, and then check if an element is visible? The selenium docs will tell you:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# ...
driver.get("http://example.com")
element = WebDriverWait(driver, 10).until(
	EC.presence_of_element_located((By.ID, "myDynamicElement"))
)

I've been kind and I've stripped some boilerplate. If you are happy about importing three objects from 4 levels of namespaces and create a wait object and pass a 2-element tuple to the "convenience method" selenium.webdriver.support.expected_conditions.visibility_of_element_located for a thing you have to do pretty much every time you click on a link, please stop reading here: type pip install selenium and off you go. The following paragraph is only for people who think the above is unsatisfactory in Python.

Still reading? Sure?

Well, I'll be honest: what I prefer to do is:

import bromine
browser = bromine.Browser(driver)
element = browser.get("http://example.com/").wait(id='myDynamicElement')

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

gambit-bromine-0.3.1.tar.gz (7.0 kB view details)

Uploaded Source

File details

Details for the file gambit-bromine-0.3.1.tar.gz.

File metadata

  • Download URL: gambit-bromine-0.3.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for gambit-bromine-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c213c361ea9bd28892da449eb940ab418c16865ef5923bbbd29ae964c82e7e98
MD5 3123e1c3b6078df44f3585e2ac292ca1
BLAKE2b-256 9e6a12dd3f6c48dac20fbc538e02162276bf68ae27d28fcc18195ee70f6e4771

See more details on using hashes here.

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