Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from splinter import Browser
- url = "http://demos.ziftsolutions.com/sample/InnovativeTechnology/?a=qlik&wid=ff808181569b6fc10156a08e41a334b7&zPage=resources-d1ef094d"
- browser = Browser('chrome')
- browser.visit(url)
- g_links_found = browser.find_link_by_partial_href('?zPage=')
- wp_links_found = browser.find_link_by_partial_text('White Paper: ')
- for link in wp_links_found:
- if link.target == "_blank":
- if link not in g_links_found:
- title = link.text[13:]
- try:
- link.click()
- if browser.is_text_present(title):
- docstatus = link.text + " is linking to the correct document."
- else:
- docstatus = link.text + " is not linking to the correct document."
- print docstatus
- except:
- print "Oops, I failed with " + link.text
- if link in g_links_found:
- docstatus = link.text + " is gated."
- print docstatus
- if link.target != "_blank":
- if link not in g_links_found:
- title = link.text[13:]
- try:
- link.click()
- if browser.is_text_present(title):
- docstatus = link.text + " is linking to the correct document."
- else:
- docstatus = link.text + " is not linking to the correct document."
- print docstatus
- except:
- print "Oops, I failed with " + link.text
- browser.back()
- if link in g_links_found:
- docstatus = link.text + " is gated."
- print docstatus
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement