def switch_to_report_view_page(driver, report_name, report_case):

        view_report_window = driver.window_handles[1]
        driver.switch_to.window(view_report_window)
        print('------window1------' + report_name)
        if report_name == 'DRG Change Condition Detail':
            ACT.wait_until_title_contains(driver, 'DRG Change Detail')
        elif report_name == 'Top 50 Diagnoses by Present on Admission(POA)':
            ACT.wait_until_title_contains(
                driver, 'Top 50 Other Diagnoses by Present on Admission(POA)')
        elif report_name == 'Management Clinical Profile':
            ACT.wait_until_title_contains(driver, 'Evaluation')
        elif 'Frequency' in report_name:
            ACT.wait_until_title_contains(driver, 'Frequency')
        else:
            ACT.wait_until_title_contains(driver, report_name)
        print(view_report_window)
        print(driver.title)
        print(
            '---wait_presence_element--------RW_ReportToolbar_ExportGr_FormatList_DropDownList----------'
        )
        print('-----driver.execute_script(document.redyState)--------')
        print(driver.execute_script('return document.readyState'))
        # wait report load fully
        ACT.wait_document_completed(driver)

        # take a screnshot
        print('---------take a screnshot-------------')
        SC.screen_shot_report_us_test_result(driver, report_name, report_case)

        print('switch_to_report_view_page' + report_name + '---------end')
Example #2
0
def login_(driver):

    driver.get(base_url.base_url)

    login_ele = driver.find_element_by_id('txtLoginid')
    password_ele = driver.find_element_by_id('txtPassword')
    login_ele_btn = driver.find_element_by_id('btnloginText')

    login_ele.clear()
    login_ele.send_keys('admin')
    password_ele.clear()
    password_ele.send_keys('Admin')
    login_ele_btn.click()
    # wait for login completed
    Act.wait_invisibility_of_element_located(driver)
    Act.wait_document_completed(driver)
    Act.wait_presence_element(driver, 'aModuleSIP101')
    Act.wait_element_clickable(driver, By.ID, 'aModuleSIP101')
    Act.wait_element_clickable(driver, By.ID, 'aSlideMenuSelModuleOP101')
    time.sleep(1)
    def test_selenium_ie(self):

        # try:
        #     keyVal = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1'
        #     key = OpenKey(HKEY_CURRENT_USER, keyVal, 0, KEY_ALL_ACCESS)
        #     SetValueEx(key, "2500", 0, REG_DWORD, 0)
        #     print("enabled protected mode")
        # except Exception:
        #     print("failed to enable protected mode")

        caps = DesiredCapabilities.INTERNETEXPLORER
        caps["platform"] = "WINDOWS"
        caps["browserName"] = "internet explorer"
        caps["requireWindowFocus"] = True
        # IE_path = 'C:\Program Files\Internet Explorer\iexplore.exe'
        # os.environ['webdriver.ie.driver'] = IE_path
        # driver = webdriver.Ie(capabilities=caps,executable_path=IE_path)
        driver = webdriver.Ie(capabilities=caps)
        driver.get('https://www.baidu.com/')
        ACT.wait_document_completed(driver)
        time.sleep(10)
        search_box = driver.find_element_by_id('kw')
        search_box.send_keys('python')
def swiitch_to_report_view_page(driver, report, report_case):
    window1 = driver.window_handles[1]
    driver.switch_to.window(window1)
    print('------window1------' + report)
    if report == 'DRG Change Condition Detail':
        ACT.wait_until_title_contains(driver, 'DRG Change Detail')
    elif report == 'Top 50 Diagnoses by Present on Admission(POA)':
        ACT.wait_until_title_contains(
            driver, 'Top 50 Other Diagnoses by Present on Admission(POA)')
    else:
        ACT.wait_until_title_contains(driver, report)
    print(window1)
    print(driver.title)
    print(
        '---wait_presence_element--------RW_ReportToolbar_ExportGr_FormatList_DropDownList----------'
    )
    print('-----driver.execute_script(document.redyState)--------')
    print(driver.execute_script('return document.readyState'))
    ACT.wait_document_completed(driver)
    # if report == 'Case Listing':
    #     ACT.wait_presence_element(driver, 'RdlViewer_ctl01_ctl05_ctl00')
    # else:
    #     ACT.wait_presence_element(driver, 'RW_ReportToolbar_ExportGr_FormatList_DropDownList')

    # take a screnshot
    print('---------take a screnshot-------------')
    test_case_number = 'TC ' + str(report_case) + '-' + report
    if report == 'Top 50 CC/MCC Diagnoses':
        picture_path = 'pictures/Top 50 CC_MCC Diagnoses.png'
    else:
        picture_path = 'pictures/' + report + '.png'
    SC.file_exists_delete(picture_path)
    picture = driver.save_screenshot(picture_path)
    SC.write_test_result_as_docx(picture_path, test_case_number)

    print('swiitch_to_report_view_page---------end')