Exemple #1
0
def execute_download(browser, document_directory, document):
    number_files = len(os.listdir(document_directory))
    build_stock_download(document)
    if document.download_type == 'free':
        open_download(browser, document)
        switch_to_default_content(browser)
        free_download(browser, document)
    elif document.download_type == 'paid':
        open_download(browser, document)
    return update_download(browser, document_directory, document, number_files)
Exemple #2
0
def execute_download(browser, abstract, document):
    access_pdf_viewer(browser, abstract, document)
    while click_button(browser, locate_element_by_id,
                       abstract.county.buttons["Download Button"],
                       "download button", document) is False:
        print(
            'Browser failed to access document image, refreshing and trying again...'
        )
        browser.refresh()
        access_pdf_viewer(browser, abstract, document)
    switch_to_default_content(browser)
def switch_to_main_frame(browser):
    switch_to_default_content(browser)
    main_frame = locate_iframe_by_name(browser, main_frame_name)
    browser.switch_to.frame(main_frame)
Exemple #4
0
def switch_to_download_frame(browser, document):
    switch_to_default_content(browser)
    download_frame = access_iframe_by_tag(browser)
    browser.switch_to.frame(download_frame)
Exemple #5
0
def free_download(browser, document):
    download_content = access_download_content(browser, document)
    free_download_link = access_free_download_button(download_content,
                                                     document)
    switch_to_default_content(browser)
    browser.get(free_download_link)
Exemple #6
0
def switch_to_main_frame(browser, abstract):
    switch_to_default_content(browser)
    main_frame = locate_element_by_name(browser, abstract.county.iframes['Main'], 'main iframe')
    browser.switch_to.frame(main_frame)