def request_page(page): print "on page", build_local_url(page) content = requests.get(build_local_url(page)).content requests.post('http://127.0.0.1:8002/wget', data={ 'origin': build_local_url(page), 'document': content, })
def main(): browser = webdriver.Firefox() # Get list of validation pages pages = get_test_lists("jquery")["validation"][:NUM_PAGES] # For each page, save a screenshot for i, p in enumerate(pages): print "Visiting page:", p.link, "...", browser.get(build_local_url(p)) screenshot_path = os.path.join(SCREENS_DIR, "page" + str(i) + ".png") browser.save_screenshot(screenshot_path) print "saved screenshot." print "Cropping page...", img = Image.open(screenshot_path) cropped = img.crop((0, 0, img.width, int(img.width * 1.5))) cropped.save(screenshot_path) print "cropped." browser.close()
def open_page(browser, p): load_success = load_link(browser, build_local_url(p)) if load_success is True: browser.execute_script(JQUERY_SCRIPT) time.sleep(.5) return load_success