Skip to content

Instantly share code, notes, and snippets.

@PritishC
Created April 4, 2015 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PritishC/f7670b3a9bb6965fae1e to your computer and use it in GitHub Desktop.
Save PritishC/f7670b3a9bb6965fae1e to your computer and use it in GitHub Desktop.
def test_all_cssmenu_links():
"""
This test function tests each link in the
drop-down. It does so by sending an HTTP request
to each link and looking for a 200 response code.
"""
with Browser() as driver:
driver.visit(PRODUCTION_URL)
div = driver.find_by_css(
'.hover-menu-class'
).first
all_anchors = div.find_by_tag('a')
for anchor in all_anchors:
print "On anchor: %s" % anchor['href']
response = requests.get(anchor['href'])
assert response.status_code == 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment