def File_Uploading(self): SeleniumOperation = SeleniumOperations(self.v_driver, self.lo) SeleniumOperation.click_element_by_xpath(ElementLocator.FTP_Refresh) self.v_driver.get(ElementLocator.FTP_File_link) SeleniumOperation.click_element_by_xpath(ElementLocator.FTP_Refresh) self.v_driver.get(ElementLocator.FTP_inbound_edi) time.sleep(5) first_parcel = ExcelOperations.get_value( ElementLocator.Edi_Parcel_file, 1, 1) second_parcel = ExcelOperations.get_value( ElementLocator.Edi_Parcel_file, 2, 1) third_parcel = ExcelOperations.get_value( ElementLocator.Edi_Parcel_file, 3, 1) SeleniumOperation.send_text_by_xpath( ElementLocator.FTP_add_file, f"C:\\Users\\Krishnabhashkar.Jha\\Downloads\\{first_parcel}.dat") time.sleep(10) SeleniumOperation.send_text_by_xpath( ElementLocator.FTP_add_file, f"C:\\Users\\Krishnabhashkar.Jha\\Downloads\\{second_parcel}.dat") time.sleep(10) SeleniumOperation.send_text_by_xpath( ElementLocator.FTP_add_file, f"C:\\Users\\Krishnabhashkar.Jha\\Downloads\\{third_parcel}.dat") time.sleep(10) # SeleniumOperation.click_element_by_xpath(ElementLocator.FTP_upload) for i in range(3): time.sleep(2) SeleniumOperation.click_element_by_xpath( ElementLocator.FTP_Refresh) break time.sleep(3) SeleniumOperation.click_element_by_xpath(ElementLocator.FTP_Logout)
def execute_main(self): login_object = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.log_file_object) error_hospital_machine_learning_object = Error_Hospital_Machine_Learning(self.v_task_type, self.v_username) report_file_object = ReportFileUtility(self.v_task_type) output_sheet = self.v_input_wb.get_sheet_by_name('Output') input_sheet = self.v_input_wb.get_sheet_by_name('Input') excel_operation_object = ExcelOperations(self.v_task_type, input_sheet) #Login into DC4 Prod login_object.login("DC4 Prod") self.log_file_object.log_to_file("INFO", "Login in to DC4 Prod") self.v_driver.execute_script("window.open('https://commerce.spscommerce.com/transaction-tracker/prod/transactions/', 'new_window')") self.v_driver.switch_to.window(self.v_driver.window_handles[-1]) time.sleep(2) #Login into Launchpad login_object.login("Launchpad") self.log_file_object.log_to_file("INFO", "Login in to Launchpad") self.v_driver.switch_to.window(self.v_driver.window_handles[0]) time.sleep(2) #Extract data from input sheet for index in range(2,input_sheet.max_row+1): today = datetime.datetime.now() DD = datetime.timedelta(days=6) earlier = today - DD earlier_str = earlier.strftime("%Y-%m-%d") earlier_str = earlier_str+' 00:00:00' v_error_title = excel_operation_object.get_value(index, 1) #Searching data as per error title if v_error_title == LocalElementLocator.ADHOC_ERROR_TITLE: self.log_file_object.log_to_file("INFO", "Seaching tickets for error title:- AdhocReporting: document rejected") v_start_time = time.time() v_ticket_uid = excel_operation_object.get_value(index, 2) if v_ticket_uid is None: v_ticket_uid = ' ' Error_Document_rejected_obj = Error_Document_rejected(self.v_task_type, self.v_driver, self.log_file_object, self.v_input_wb, error_hospital_machine_learning_object) v_count = Error_Document_rejected_obj.execute_main(v_error_title, v_ticket_uid, output_sheet, earlier_str) v_end_time = time.time() report_file_object.update_sheet(self.v_username, v_count, math.floor(v_end_time - v_start_time), str(datetime.date.today())) if v_error_title == LocalElementLocator.WEB_DOC_REJECTED_ERROR_TITLE: self.log_file_object.log_to_file("INFO", "Seaching tickets for error title:- WebForms-ToService: document rejected") v_start_time = time.time() v_ticket_uid = excel_operation_object.get_value(index, 2) if v_ticket_uid is None: v_ticket_uid = ' ' Error_Document_rejected_obj = Error_Document_rejected(self.v_task_type, self.v_driver, self.log_file_object, self.v_input_wb, error_hospital_machine_learning_object) v_count = Error_Document_rejected_obj.execute_main(v_error_title, v_ticket_uid, output_sheet, earlier_str) v_end_time = time.time() report_file_object.update_sheet(self.v_username, v_count, math.floor(v_end_time - v_start_time), str(datetime.date.today())) else: self.log_file_object.log_to_file("ERROR", "Invalid error title ErrorHospital.execute_main()") time.sleep(3) self.v_driver.close()
def Extensions_validation(self): self.log.log_to_file(self, "INFO", " Start Extension_validation in Receiver Side ! ") self.extension = pandas.read_excel(Element.Extention_File_Path, sheet_name="Sheet1") self.extension = self.extension[self.extension.Extensions.str.contains('MapExtension')] self.extension['Extensions'] = self.extension['Extensions'].str.split(' ').str[1] if self.extension['Extensions'].str.contains('split').any() == True: self.splitter = ExcelOperations.get_value(file.Output_File_Path,5,2) # print(self.splitter) if self.splitter == True: print("Splitter Map is present") self.log.log_to_file(self, "INFO", " Splitter Map is present in Receiver Side ! ") # ExcelOperations.set_value_to_cell(file.Output_File_Path, 5, 2, 'TRUE') # setup_methods.Warning(self, 'cancel', 'Splitter Map is present') else: if self.splitter == True: print("Splitter Map is not There") self.log.log_to_file(self, "INFO", " Splitter Map is NOT present in Receiver Side ! ") # ExcelOperations.set_value_to_cell(file.Output_File_Path, 5, 2, 'FALSE') setup_methods.Warning(self, 'cancel', 'SDQ Segment is there but Splitter Map is not There !') self.extension = self.extension[self.extension.Extensions.str.contains('conversion')] print(self.extension)
def execute_main(self): v_start_time = time.time() self.lo.log_to_file("INFO", "Login in to DC4 Prod") lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo) so = SeleniumOperations(self.v_task_type,self.v_driver,self.lo) ehu = ErrorHospital_Utility(self.v_task_type,self.v_driver,self.lo) rf = ReportFileUtility(self.v_task_type) output_sheet = self.v_input_wb.get_sheet_by_name('Output') input_sheet = self.v_input_wb.get_sheet_by_name('Input') eo = ExcelOperations(self.v_task_type, input_sheet) output_sheet_eo = ExcelOperations(self.v_task_type, output_sheet) output_sheet_curr_row = 2 for index in range(2,input_sheet.max_row+1): list_duplicate_ticket_uid = [] today = datetime.datetime.now() DD = datetime.timedelta(days=14) earlier = today - DD earlier_str = earlier.strftime("%Y-%m-%d") earlier_str = earlier_str+' 00:00:00' lg.login("DC4 Prod") v_error_title = eo.get_value(index, 1) if v_error_title == LocalElementLocator.ADHOC_ERROR_TITLE: v_ticket_uid = eo.get_value(index, 2) if v_ticket_uid is None: v_ticket_uid = ' ' ehu.adhoc_error_search(v_ticket_uid,earlier_str,' ') if so.check_exists_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH): so.click_element_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH) tuid_index = 2 while(ehu.get_ticket_uid(tuid_index)): temp_ticket_uid = ehu.get_ticket_uid(tuid_index) temp_receiver = ehu.get_receiver_name(tuid_index) temp_sender = ehu.get_sender_name(tuid_index) if temp_ticket_uid not in list_duplicate_ticket_uid: ehu.adhoc_error_search(temp_ticket_uid,earlier_str,' ') v_tpid, v_doctype = ehu.get_info_from_description(tuid_index-2) ehu.adhoc_error_search(' ', earlier_str,v_tpid) if so.check_exists_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH): so.click_element_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH) temp_tuid_index = 2 while (ehu.get_ticket_uid(temp_tuid_index)): list_duplicate_ticket_uid.append(ehu.get_ticket_uid(temp_tuid_index)) temp_tuid_index = temp_tuid_index+1 output_sheet_eo.set_value(output_sheet_curr_row, 1, temp_ticket_uid) output_sheet_eo.set_value(output_sheet_curr_row, 2, temp_sender) output_sheet_eo.set_value(output_sheet_curr_row, 3, temp_receiver) output_sheet_eo.set_value(output_sheet_curr_row, 4, v_tpid) output_sheet_eo.set_value(output_sheet_curr_row, 5, v_doctype) output_sheet_curr_row = output_sheet_curr_row+1 self.v_input_wb.save(AppConstants.INPUT_FILE_PATH) ehu.adhoc_error_search(v_ticket_uid, earlier_str, ' ') if so.check_exists_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH): so.click_element_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH) tuid_index = tuid_index+1 #so.click_element(AppConstants.DC4_TAB, "BY_NAME") #dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo) #dc.company_search_by_name('Midlab Inc') #dc.company_search_by_ISA_ID('6166651648') #dc.company_search_by_TPID('620TSTWONDERTRE') self.v_driver.close() v_end_time = time.time() rf.update_sheet(self.v_username, 2, math.floor(v_end_time - v_start_time), str(datetime.date.today()))
def execute_main(self): db_object = DatabaseUtility(self.v_task_type, self.lo) if db_object.connection(): self.lo.log_to_file('INFO', 'Successful Connection') else: self.lo.log_to_file('ERROR', 'DB Server is not active') return v_start_time = time.time() self.lo.log_to_file("INFO", "Login in to DC4 Prod") login_obj = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo) selenium_operation_obj = SeleniumOperations(self.v_task_type, self.v_driver, self.lo) report_file_obj = ReportFileUtility(self.v_task_type) input_sheet = self.v_input_wb.get_sheet_by_name('Input') input_sheet_row_count = input_sheet.max_row excel_operation_obj = ExcelOperations(self.v_task_type, input_sheet) Web_Fulfillment_Utility_obj = Web_Fulfillment_Utility( self.v_task_type, self.v_driver, self.v_input_wb, self.lo, self.v_username, db_object) login_obj.login("Salesforce") self.v_driver.execute_script( "window.open('http://dc4ui.p01.pro:7777/dc4custmanager/faces/home.jsp', 'new_window')" ) # self.v_driver.execute_script( # "window.open('https://atlassian.spscommerce.com/browse/FICS-163692', 'new_window')") self.v_driver.switch_to.window(self.v_driver.window_handles[-1]) report_file_object = ReportFileUtility(self.v_task_type) time.sleep(2) login_obj.login("DC4 Prod") input_row = excel_operation_obj.get_value(2, 4) FICS_Number = excel_operation_obj.get_value(input_row, 1) while (FICS_Number != None): v_start_time = time.time() v_salesforce_id = FICS_Number self.v_driver.switch_to.window(self.v_driver.window_handles[0]) time.sleep(2) #self.v_driver.get('https://atlassian.spscommerce.com/browse/'+FICS_Number) #v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, v_salesforce_id = Web_Fulfillment_Utility_obj.get_info_from_JIRA() v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name = Web_Fulfillment_Utility_obj.get_info_from_salesforce( v_salesforce_id) print(v_salesforce_id + "\n" + v_supplier_name + "\n" + v_email_address + "\n" + v_phone_number + "\n" + v_retailer_name + "\n" + v_vendor_number + "\n" + v_retailer_web_company_uid + "\n" + v_account_number + "\n" + v_retailer_dc4_company_uid + "\n" + v_contact_name) print(v_billing_address) self.v_driver.switch_to.window(self.v_driver.window_handles[-1]) time.sleep(2) try: #Web_Fulfillment_Utility_obj.get_data_for_library(v_salesforce_id, v_supplier_name, v_retailer_name, v_retailer_dc4_company_uid, FICS_Number) Web_Fulfillment_Utility_obj.run_setup_tool( v_salesforce_id, v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name) except: self.v_driver.save_screenshot(AppConstants.APP_RUNNER_PATH + v_salesforce_id + '.png') print(input_row) v_end_time = time.time() report_file_object.update_sheet( self.v_username, 1, math.floor(v_end_time - v_start_time), str(datetime.date.today())) input_row = input_row + 1 excel_operation_obj.set_value(2, 4, input_row) FICS_Number = excel_operation_obj.get_value(input_row, 1) time.sleep(2)
def execute_main(self): t1 = threading.Thread(target=self.thread1) t2 = threading.Thread(target=self.thread2) t1.start() t2.start() t1.join() t2.join() db_object = DatabaseUtility(self.v_task_type, self.lo) if db_object.connection(): self.lo.log_to_file('INFO', 'Successful Connection') else: self.lo.log_to_file('ERROR', 'DB Server is not active') return v_start_time = time.time() self.lo.log_to_file("INFO", "Login in to DC4 Prod") login_obj = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo) selenium_operation_obj = SeleniumOperations(self.v_task_type, self.v_driver, self.lo) report_file_obj = ReportFileUtility(self.v_task_type) input_sheet = self.v_input_wb.get_sheet_by_name('Input') input_sheet_row_count = input_sheet.max_row excel_operation_obj = ExcelOperations(self.v_task_type, input_sheet) Web_Fulfillment_Utility_obj = Web_Fulfillment_Utility( self.v_task_type, self.v_driver, self.v_input_wb, self.lo, self.v_username, db_object, self.v_driver_mv) # login_obj.login("Salesforce") self.v_driver.execute_script( "window.open('http://dc4ui.p01.pro:7777/dc4custmanager/faces/home.jsp', 'new_window')" ) # self.v_driver.execute_script( # "window.open('https://atlassian.spscommerce.com/browse/FICS-163692', 'new_window')") self.v_driver.switch_to.window(self.v_driver.window_handles[-1]) report_file_object = ReportFileUtility(self.v_task_type) time.sleep(2) login_obj.login("DC4 Prod") input_row = input_sheet_row_count + 1 FICS_Number = excel_operation_obj.get_value(input_row, 1) flag = 1 count = 0 v_start_time = time.time() while (flag): v_start_time1 = time.time() v_salesforce_id = easygui.enterbox('Please enter salesforce ID') self.v_driver.switch_to.window(self.v_driver.window_handles[0]) time.sleep(2) #self.v_driver.get('https://atlassian.spscommerce.com/browse/'+FICS_Number) #v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, v_salesforce_id = Web_Fulfillment_Utility_obj.get_info_from_JIRA() v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, client_uid, retailer_uid = Web_Fulfillment_Utility_obj.get_info_from_salesforce( v_salesforce_id) print(v_salesforce_id + "\n" + v_supplier_name + "\n" + v_email_address + "\n" + v_phone_number + "\n" + v_retailer_name + "\n" + v_vendor_number + "\n" + v_retailer_web_company_uid + "\n" + v_account_number + "\n" + v_retailer_dc4_company_uid + "\n" + v_contact_name) print(v_billing_address) self.v_driver.switch_to.window(self.v_driver.window_handles[-1]) time.sleep(2) #Web_Fulfillment_Utility_obj.get_data_for_library(v_salesforce_id, v_supplier_name, v_retailer_name, v_retailer_dc4_company_uid, FICS_Number) Web_Fulfillment_Utility_obj.run_setup_tool( v_salesforce_id, v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, client_uid, retailer_uid) print(input_row) count = count + 1 excel_operation_obj.set_value(input_row, 1, count) FICS_Number = excel_operation_obj.get_value(input_row, 1) v_end_time1 = time.time() excel_operation_obj.set_value( input_row, 2, math.floor(v_end_time1 - v_start_time1)) excel_operation_obj.set_value(input_row, 3, datetime.date.today()) print( '----------------------------------------------\n\nExecution Time: ' + str(math.floor(v_end_time1 - v_start_time1)) + ' count: ' + str(count) + '\n\n-------------------------') time.sleep(2) input_row = input_row + 1 self.v_input_wb.save(AppConstants.INPUT_FILE_PATH) flag = easygui.ynbox('Do you want to run one more setup?') v_end_time = time.time() report_file_object.update_sheet(self.v_username, count, math.floor(v_end_time - v_start_time), str(datetime.date.today()))