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)
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)
def find_report_ip(self, driver, report_name): #ACT.wait_presence_element(driver,'spnSearch') #ACT.wait_invisibility_of_element_located(driver) ACT.wait_modal_overlay_element(driver, By.ID, 'spnSearch') txtSearch_report = driver.find_element_by_id('txtSearch') txtSearch_report.clear() txtSearch_report.click() txtSearch_report.send_keys(report_name) spnSearch_report = driver.find_element_by_id('spnSearch') spnSearch_report.click()
def go_to_report_ip_Enterprise(self,driver): # Click "inpatient" 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 Enterprise Reports"]') # Click "Inpatient Enterprise Reports" enterprice_link = driver.find_element_by_xpath('//span[text()="Inpatient Enterprise Reports"]') enterprice_link.click() # wait ACT.wait_presence_element(driver,'txtSearch')
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)
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)
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 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------------')
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)
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')
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)
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-----')
def test_navigate_ip_report_cs_firefox(self): # profile = webdriver.FirefoxProfile() # profile.set_preference("network.proxy.type", 1) # profile.set_preference("network.proxy.http", "proxy.server.address") # profile.set_preference("network.proxy.http_port", "port_number") # profile.update_preferences() # driver = webdriver.Firefox(firefox_profile=profile) #activate a browser driver = webdriver.Firefox() driver.maximize_window() reports_dic_standard = SC.read_file_as_list_report_US299725('standard') reports_values = list(reports_dic_standard.values()) reports_keys = list(reports_dic_standard.keys()) SC.login_(driver) # go to report search page # IP_report.go_to_report_ip_Enterprise(driver) IP_report.go_to_report_ip_Standard(driver) for i in range(0, reports_dic_standard.__len__()): report = reports_values[i] # report = 'Frequency' # find "report name" try: IP_report.find_report_ip(driver, report) except: print('---try--except------'+report+'--not found-----') # continue # click "report name" IP_report.go_to_report_CS(driver, report) # add filters besides the default ones IP_report.add_filters_besides_default_ones(driver,i) # operator #value # 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_element_clickable(driver, By.XPATH, # '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]') # # value_select_tr1 = driver.find_element_by_xpath( # '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[1]') # value_select_tr1.click() # # KEY.KeyboardKeys.keyDown(KEY.KeyboardKeys.VK_CODE['shift']) # # value_select_last = driver.find_element_by_xpath( # '//div[@id="dvLookupuGrid"]/div[@class="k-grid-content"]/table/tbody/tr[last()]') # value_select_last.click() #operator_dropdown = driver.find_elements_by_xpath('//div[@class="k-animation-container"][1]/div/ul/li') # Click "View report" IP_report.view_report_by_default_filters(driver) # Go to report view page IP_report.swiitch_to_report_view_page(driver, report, reports_keys[i]) # Export report # IP_report.export_report(driver, report) handles = driver.window_handles driver.close() driver.switch_to.window(handles[0]) ACT.wait_invisibility_of_element_located(driver) close = driver.find_element_by_xpath('//span[text()="close"]') close.click()
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)
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------------')
def close_report_view_window(driver): handles = driver.window_handles driver.close() driver.switch_to.window(handles[0]) ACT.wait_invisibility_of_element_located(driver)
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')
def test_US299725_IE11(self): # IE_path = r'C:\Program Files\Internet Explorer\ExtExport.exe' # os.environ['webdriver.ie.driver'] = IE_path # driver = webdriver.Ie(IE_path) caps = DesiredCapabilities.INTERNETEXPLORER caps = { 'ignoreProtectedModeSettings': True, 'ignore_protected_mode_settings': True, 'ignore_zoom_level': True, 'native_events': False, 'persistent_hover': False, 'ELEMENT_SCROLL_BEHAVIOR': True, 'require_window_focus': True } opts = IEoptions() opts.ignore_protected_mode_settings = True opts.ignore_zoom_level = True opts.require_window_focus = True opts.native_events = False opts.ignore_protected_mode_settings = True opts.persistent_hover = False opts.ELEMENT_SCROLL_BEHAVIOR = True # opts.ensure_clean_session = True # ie_options=opts,executable_path=IE_path, driver = webdriver.Ie(options=opts) reports_dic_enterprise = SC.read_file_as_list_report_US299725('enterprise') reports_values = list(reports_dic_enterprise.values()) reports_keys = list(reports_dic_enterprise.keys()) SC.login_(driver) # go to report search page # IP_report.go_to_report_ip_Enterprise(driver) IP_report.go_to_report_ip_Enterprise(driver) for i in range(10, 19): report = reports_values[i] # find "report name" try: IP_report.find_report_ip(driver, report) except: print('---try--except------' + report + '--not found-----') # click "report name" IP_report.go_to_report_CS(driver, report) # add filters besides the default ones IP_report.add_filters_besides_default_ones(driver, i) # Click "View report" IP_report.view_report_by_default_filters(driver) # Go to report view page IP_report.swiitch_to_report_view_page(driver, report, reports_keys[i]) # Export report # IP_report.export_report(driver, report) handles = driver.window_handles driver.close() driver.switch_to.window(handles[0]) ACT.wait_invisibility_of_element_located(driver) close = driver.find_element_by_xpath('//span[text()="close"]') close.click()