コード例 #1
0
def export_report(driver, report):
    print('-------------export_report------------------')
    # click "format"
    # case list RdlViewer_ctl01_ctl05_ctl00
    if report == 'Case Listing':
        format_list = driver.find_element_by_id('RdlViewer_ctl01_ctl05_ctl00')
    else:
        format_list = driver.find_element_by_id(
            'RW_ReportToolbar_ExportGr_FormatList_DropDownList')
    format_list.click()
    # select a formt
    PDF = driver.find_element_by_xpath("//option[text()='Acrobat (PDF) file']")
    PDF.click()

    # formats_options = driver.find_element_by_xpath("//select[@id='RW_ReportToolbar_ExportGr_FormatList']/option[0]")
    # print(formats_options)

    ACT.wait_element_clickable(driver, By.LINK_TEXT, 'Export')
    # take a screnshot
    driver.save_screenshot('pictures/' + report + '.png')
    # click "Export"
    expoert_btn = driver.find_element_by_link_text('Export')
    #expoert_btn = driver.find_element_by_id('RW_ReportToolbar_ExportGr_Export')
    expoert_btn.click()

    k = PyKeyboard()
    k.tap_key(k.enter_key)
コード例 #2
0
def go_to_report_ip_Enterprise(driver):

    # work for firefox and chrome
    # Click "inpatient"
    # ACT.wait_element_clickable(driver, By.ID, 'aModuleSIP101')
    # ACT.wait_invisibility_of_element_located(driver)
    # inpatient = driver.find_element_by_id('aModuleSIP101')
    # inpatient.click()
    # for IE11
    ACT.wait_element_clickable(driver, By.ID, 'aSlideMenuSelModuleSIP101')
    ACT.wait_invisibility_of_element_located(driver)
    inpatient = driver.find_element_by_id('aSlideMenuSelModuleSIP101')
    inpatient.click()

    # Click "report"
    report = driver.find_element_by_id('aIPModuleWorkplans')
    report.click()
    ACT.wait_presence_element_xpath(
        driver, '//span[text()="Inpatient Enterprise Reports"]')

    # Click "Inpatient Enterprise Reports"
    enterprice_link = driver.find_element_by_xpath(
        '//span[text()="Inpatient Enterprise Reports"]')
    enterprice_link.click()
    # wait
    ACT.wait_invisibility_of_element_located(driver)
コード例 #3
0
 def view_report(driver):
     # click 'View Report' button
     btnViewReport = driver.find_element_by_id('btnViewReport')
     ACT.wait_element_clickable(driver, By.ID, 'btnViewReport')
     ACT.wait_invisibility_of_element_located(driver)
     btnViewReport.click()
     ACT.wait_invisibility_of_element_located(driver)
     time.sleep(1)
     print('--------view_report_by_default_filters------------')
コード例 #4
0
    def find_report(driver, report_name):

        ACT.wait_presence_element(driver, 'spnSearch')
        # ACT.wait_invisibility_of_element_located(driver)

        ACT.wait_modal_overlay_element(driver, By.ID, 'txtSearch')
        txtSearch_report = driver.find_element_by_id('txtSearch')

        ACT.wait_element_clickable(driver, By.ID, 'txtSearch')
        ACT.wait_presence_element(driver, 'txtSearch')
        time.sleep(5)
        txtSearch_report.clear()
        txtSearch_report.click()
        txtSearch_report.send_keys(report_name)

        spnSearch_report = driver.find_element_by_id('spnSearch')
        spnSearch_report.click()
        ACT.wait_element_clickable(driver, By.PARTIAL_LINK_TEXT, report_name)
        time.sleep(1)
コード例 #5
0
    def go_to_report_ip_Standard(driver):
        # Click "inpatient"
        ACT.wait_element_clickable(driver, By.ID, 'aModuleSIP101')
        ACT.wait_invisibility_of_element_located(driver)
        inpatient = driver.find_element_by_id('aModuleSIP101')
        inpatient.click()

        # Click "report"
        report = driver.find_element_by_id('aIPModuleWorkplans')
        report.click()
        ACT.wait_presence_element_xpath(
            driver, '//span[text()="Inpatient Standard Reports"]')

        # Click "Inpatient Standard Reports"
        standard_link = driver.find_element_by_xpath(
            '//span[text()="Inpatient Standard Reports"]')
        standard_link.click()
        # wait
        ACT.wait_invisibility_of_element_located(driver)
コード例 #6
0
    def go_to_report_CS(driver, report_name):

        if report_name == 'Frequency':

            # Case_Listing_link = driver.find_elements_by_link_text(report_name)[1]
            # Case_Listing_links = driver.find_elements_by_xpath("//a[text()="+report_name+"]")
            # print(len(Case_Listing_links))
            # Case_Listing_link = Case_Listing_links[1]
            Case_Listing_link = driver.find_elements_by_partial_link_text(
                report_name)[3]
        else:
            Case_Listing_link = driver.find_element_by_partial_link_text(
                report_name)

        print('---go_to_report_CS---double_click------')
        ActionChains(driver).double_click(Case_Listing_link).perform()
        ACT.wait_invisibility_of_element_located(driver)
        ACT.wait_presence_element(driver, 'btnViewReport')
        ACT.wait_element_clickable(driver, By.ID, 'btnViewReport')
        time.sleep(5)
コード例 #7
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)
コード例 #8
0
    def go_to_op_standard(driver):
        # click "Outpatient"
        ACT.wait_element_clickable(driver, By.ID, 'aSlideMenuSelModuleOP101')
        outpatient_enter = driver.find_element_by_id(
            'aSlideMenuSelModuleOP101')
        ACT.wait_invisibility_of_element_located(driver)
        outpatient_enter.click()

        # click "Reports"
        ACT.wait_element_clickable(driver, By.ID, 'aOPModuleWorkplans')
        OP_report_enter = driver.find_element_by_id('aOPModuleWorkplans')
        OP_report_enter.click()

        # Click "Outpatient Standard Reports"
        xpath = '//span[text()="Outpatient Standard Reports"]'
        ACT.wait_element_clickable(driver, By.XPATH, xpath)
        enterprice_link = driver.find_element_by_xpath(xpath)
        enterprice_link.click()
        # wait
        ACT.wait_invisibility_of_element_located(driver)
コード例 #9
0
    def test_enterprise_reports(self):

        field_list = []
        field_dic = {}

        driver = self.driver
        SC.login_(driver)
        reports.reports.go_to_op_standard(driver)

        report_name = 'Visits Processed on Import'

        reports.reports.find_report(driver, report_name)
        reports.reports.go_to_report_CS(driver, report_name)

        # reports.reports.add_filters_besides_default_ones(driver)
        # set up filters
        ACT.wait_element_clickable(driver, By.ID, 'btnInsertClause')
        add_icon = driver.find_element_by_id('btnInsertClause')
        add_icon.click()
        driver.find_element_by_id('customsearch-grid-div')
        field_last = driver.find_element_by_xpath(
            './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[3]/span'
        )
        field_last.click()

        # cycle all the options under field dropdown
        field_names_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li'
        field_names = driver.find_elements_by_xpath(field_names_xpath)
        print('----------------------------------------------------')
        field_values = []
        for item in field_names:
            print(item.text)
            field_values.append(item.text)

        print('----------------------------------------------------')
        for i in range(0, len(field_values)):
            print('----------------------------------------------------')
            print(i)
            tools.spide_write_to_txt(field_values[i],
                                     '../Smart_commons/cs_fields.txt')
            print(field_values[i])
            field_dic['id'] = field_values[i]

            if i == 0:
                print(i)
            else:
                driver.find_element_by_id('customsearch-grid-div')
                field_last = driver.find_element_by_xpath(
                    '//div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[3]/span'
                )
                field_last.click()

            field_name = field_values[i]
            field_names_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li'
            field_names = driver.find_elements_by_xpath(field_names_xpath)

            for i in field_names:
                print(i.text)

            field_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li[text()="' + field_name + '"]'
            print(field_xpath)
            ACT.wait_presence_element_xpath(driver, field_xpath)
            ACT.wait_element_clickable(driver, By.XPATH, field_xpath)
            field_name_select = driver.find_element_by_xpath(field_xpath)
            field_name_select.click()

            print('------click----field_name-----------' + field_name)

            # operator
            # click "operator" button
            operator = driver.find_element_by_xpath(
                '//div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[4]/span'
            )
            operator.click()
            # cycle all the options under ope dropdown
            operator_names_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li'
            operator_names = driver.find_elements_by_xpath(
                operator_names_xpath)

            operator_names[1].click()
            operators = ''
            for item in operator_names:
                tools.spide_write_to_txt(item.text,
                                         '../Smart_commons/cs_operators.txt')
                operators = operators + item.text + ','
                print(item.text)
            field_dic['operators'] = operators

            # click 'value' field
            xpath = './/div[@id="customsearch-grid"]/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[6]/input'
            value_input = driver.find_element_by_xpath(xpath)
            value_input_property = value_input.get_property('disabled')
            print('----value_input_style-------')
            print(value_input_property)
            field_dic['type'] = 'input'
            field_dic['default'] = 'default'

            field_list.append(field_dic)
        tools.write_dics_list_to_xml('Fields', 'Field', field_list,
                                     '../Smart_commons/cs_fields.xml')
        for i in field_list:
            print(i)
コード例 #10
0
    def add_filters_besides_default_ones(driver):

        # set up filters
        ACT.wait_element_clickable(driver, By.ID, 'btnInsertClause')
        add_icon = driver.find_element_by_id('btnInsertClause')
        add_icon.click()

        # add filters besides the default ones
        # click 'Field' dropdown
        driver.find_element_by_id('customsearch-grid-div')
        field_last = driver.find_element_by_xpath(
            './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[3]/span'
        )
        field_last.click()

        # fields_lis = driver.find_elements_by_xpath('//div[@class="k-animation-container"][last()]/div/ul/li')
        # print(fields_lis.__len__())
        # for li in fields_lis:
        #     print(li.text)

        # cycle all the options under field dropdown
        field_names_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li'
        field_names = driver.find_elements_by_xpath(field_names_xpath)
        for item in field_names:
            print(item.text)

        # select a field
        field_name = 'ICD Dx Codes - Admit'
        field_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li[text()="' + field_name + '"]'
        print(field_xpath)
        ACT.wait_presence_element_xpath(driver, field_xpath)
        ACT.wait_element_clickable(driver, By.XPATH, field_xpath)
        field_name_select = driver.find_element_by_xpath(field_xpath)
        field_name_select.click()
        print('----------field_name-----------')
        print(field_name)

        #operator

        # click "operator" button
        operator = driver.find_element_by_xpath(
            '//div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[4]/span'
        )
        operator.click()

        # cycle all the options under ope dropdown
        operator_names_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li'
        operator_names = driver.find_elements_by_xpath(operator_names_xpath)
        for item in field_names:
            tools.spide_write_to_txt(item.text,
                                     '../Smart_commons/cs_operators.txt')
            print(item.text)

        # select operator_value  < Less Than In
        operator_value = '<> Not Equal'
        ACT.wait_presence_element_xpath(
            driver,
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_in = driver.find_element_by_xpath(
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_in.click()

        # click 'value' field
        xpath = './/div[@id="customsearch-grid"]/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[6]/input'
        value_input = driver.find_element_by_xpath(xpath)
        value_input.click()
        value_input.send_keys('434.91')
        print('-------send_keys---------Z12.11--434.91-----')
コード例 #11
0
def add_filters_besides_default_ones(driver, n):

    # set up filters
    ACT.wait_element_clickable(driver, By.ID, 'btnInsertClause')
    add_icon = driver.find_element_by_id('btnInsertClause')
    add_icon.click()

    # add filters besides the default ones
    driver.find_element_by_id('customsearch-grid-div')
    fields = driver.find_elements_by_xpath(
        './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr'
    )
    fields_len = fields.__len__()
    print('-----------fields_len = fields.__len__()-------------')
    print(fields_len)

    field_last = driver.find_element_by_xpath(
        './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[3]/span'
    )
    field_last.click()

    fields_lis = driver.find_elements_by_xpath(
        '//div[@class="k-animation-container"][last()]/div/ul/li')
    print(fields_lis.__len__())
    for li in fields_lis:
        print(li.text)

    # Case State - First Version DRG Type
    # value
    # fields_names = SC.read_file_as_list('custom_search_fields.txt')
    fields_names = [
        'DRG Type', 'Case State - First Version',
        'ICD Proc Codes - Principal - First Version',
        'Major Diagnostic Category – First Version'
    ]
    print('------nnnnnnnnnnnnnnnnnnn----')
    print(n)
    if n % 4 == 1:
        print(n % 4 == 1)
        field_name = 'DRG Type'
    elif n % 4 == 2:
        print('n % 4 == 2')
        field_name = 'Case State - First Version'
    elif n % 4 == 0:
        print('n % 4 == 0')
        field_name = 'Major Diagnostic Category - First Version'
    else:
        print('n % 4 == 3')
        field_name = 'Case State - First Version'
    field_name = 'Case State - First Version'

    field_xpath = '//div[@class="k-animation-container"][last()]/div/ul/li[text()="' + field_name + '"]'
    print(field_xpath)
    ACT.wait_presence_element_xpath(driver, field_xpath)
    ACT.wait_element_clickable(driver, By.XPATH, field_xpath)
    field_name_select = driver.find_element_by_xpath(field_xpath)
    field_name_select.click()
    print('----------field_name-----------')
    print(field_name)

    #operator
    # operator
    operator = driver.find_element_by_xpath(
        '//div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[4]/span'
    )
    operator.click()

    if field_name == 'DRG Type':

        operator_value = 'In'
        ACT.wait_presence_element_xpath(
            driver,
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_in = driver.find_element_by_xpath(
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_in.click()
        value_input = driver.find_element_by_xpath(
            './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[4]/span/input'
        )
        value_input.send_keys('AP,APR,MC,MS')
        print('-------send_keys-----------AP,APR,MC,MS-----')
        # value_a = driver.find_element_by_xpath('.//div[@id="customsearch-grid-div"]/div/div['
        #                                        '@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[4]/span/a')
        #
        # value_a.click()
        #
        # ACT.wait_invisibility_of_element_located(driver)
        # ACT.wait_presence_element_xpath(driver, '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]')
        # value_select = driver.find_element_by_xpath('//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]')
        # value_select.click()

    elif field_name == 'Case State - First Version':
        print('field_name == Case State - First Version')
        operator_value = '<> Not Equal'
        operator_in = driver.find_element_by_xpath(
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_in.click()
        value_a = driver.find_element_by_xpath(
            './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[4]/span/a'
        )
        value_a.click()

        ACT.wait_invisibility_of_element_located(driver)
        ACT.wait_presence_element_xpath(
            driver,
            '//div[@id="dvCSLookupPopup"]/div[@id="dvSearchLookupContent"]/div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]'
        )
        # for IE
        # value_select_box = driver.find_element_by_id('ui-id-9')
        # value_select_box.click()
        #
        # value_select_div = driver.find_element_by_id('dvCSLookupPopup')
        # value_select_div.click()
        # for IE
        # value_select_td = driver.find_elements_by_css_selector('td[role="gridcell"]')[0]
        # value_select_td.click()

        value_select = driver.find_element_by_xpath(
            '//div[@id="dvSearchLookupContent"]/div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]/td[1]'
        )
        xpath = '//div[@id="dvSearchLookupContent"]/div[@id="dvLookupuGrid"]' \
                '/div[@class="k-grid-content"]/table/tbody/tr[1]/td[1]'
        print('---------value_select IE-----------')
        value_select.click()

        # for IE11
        # value_select_xpath2 = './/td[text()="Flagged - Pending"]'
        # value_select_2 = driver.find_element_by_xpath(value_select_xpath2)
        # value_select_2.click()

        # # for IE11
        # btSelect = driver.find_element_by_id('btnSelect')
        # # driver.get("javascript:document.getElementById('btnSelect').click();")
        # btSelect.click()

    elif field_name == 'ICD Proc Codes - Principal - First Version':
        operator_value = '>= Greater Than or Equal'
        operator_GT = driver.find_element_by_xpath(
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_GT.click()
        ACT.wait_presence_element_xpath(
            driver,
            './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[4]/span/input'
        )
        value_input = driver.find_element_by_xpath(
            './/div[@id="customsearch-grid"]/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[6]/input'
        )
        # V15.82
        value_input.send_keys('E08.10')
        # ACT.wait_invisibility_of_element_located(driver)
        # ACT.wait_element_clickable(driver, By.XPATH,
        #                            '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]')
        # value_select = driver.find_element_by_xpath(
        #     '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]/td[2]')
        # value_select.click()
    # field_name == 'Major Diagnostic Category - First Version'
    elif field_name == 'Major Diagnostic Category - First Version':
        print('999999999999999999999999999999999999999999999999999')
        operator_value = '<> Not Equal'
        operator_equal = driver.find_element_by_xpath(
            '//div[@class="k-animation-container"][last()]/div/ul/li[text()="'
            + operator_value + '"]')
        operator_equal.click()

        #click search icon
        value_a_xpath = './/div[@id="customsearch-grid"]/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[4]/span/a'
        ACT.wait_element_clickable(driver, By.XPATH, value_a_xpath)
        ACT.wait_presence_element_xpath(driver, value_a_xpath)
        value_a = driver.find_element_by_xpath(value_a_xpath)
        value_a.click()

        ACT.wait_invisibility_of_element_located(driver)
        ACT.wait_presence_element_xpath(
            driver,
            '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]/td[2]'
        )
        value_select = driver.find_element_by_xpath(
            '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]/td[2]'
        )

        value_select.click()

    # value_a = driver.find_element_by_xpath(
    #     './/div[@id="customsearch-grid-div"]/div/div[@class="k-grid-content"]/table/tbody/tr[last()]/td[5]/div/div[4]/span/a')
    # value_a.click()
    #
    # ACT.wait_invisibility_of_element_located(driver)
    # ACT.wait_presence_element_xpath(driver,
    #                                 '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]')
    # value_select = driver.find_element_by_xpath(
    #     '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]')
    # value_select.click()
    print('-----------set_report_filters------------')