def call_check_accepted(self, v_supplier, v_retailer, v_doc_type, v_date):
     print("In Call check accepted")
     self.v_driver.execute_script("window.open('about:blank', 'tab3');")
     self.v_driver.switch_to.window("tab3")
     time.sleep(3)
     self.v_driver.get(
         "https://commerce.spscommerce.com/transaction-tracker/prod/transactions/"
     )
     time.sleep(8)
     tt_operations = TransactionTrackerOperations(self.v_driver, self.lo)
     tt_operations.search_process_for_process_test_file(
         v_supplier, v_retailer, v_doc_type, v_date, "preprod")
     time.sleep(5)
     SeleniumOperation = SeleniumOperations(self.v_driver, self.lo)
     # self.v_driver.switch_to.frame(1)
     time.sleep(2)
     a = SeleniumOperation.get_text_by_xpath(ElementLocator.accepted1)
     if a == "Accepted":
         print("First Parcel is Accepted")
         pass
     b = SeleniumOperation.get_text_by_xpath(ElementLocator.accepted2)
     if b == "Accepted":
         print("Second Parcel is Accepted")
         pass
     c = SeleniumOperation.get_text_by_xpath(ElementLocator.accepted3)
     if a == "Accepted":
         print("Third Parcel is Accepted")
         pass
    def process(self, path):
        self.lo.log_to_file("INFO", "Executing TT_File_Download.process()")
        supplier_name = self.v_input_sheet.cell(row=2, column=1).value
        retailer_name = self.v_input_sheet.cell(row=2, column=2).value
        doc_type = self.v_input_sheet.cell(row=2, column=3).value
        date = self.v_input_sheet.cell(row=2, column=4).value
        ptfu = Process_Test_Files_Utility(self.v_task_type, self.v_driver,
                                          self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        time.sleep(3)
        self.v_driver.switch_to.frame(0)
        ptfu.search_by_names(supplier_name, retailer_name, doc_type, date)
        ptfu.get_five_parcels()
        path = CommonLocators.PROCESS_PATH

        #After Getting parcels, search with parcelID
        with open(path) as f:
            for line in f:
                parcel = line.replace('\n', '')
                ptfu.search_by_parcel_id(str(parcel))
                so.click_element_by_xpath(CommonLocators.TRANSAFORMATION)
                element = WebDriverWait(self.v_driver, 20).until(
                    EC.element_to_be_clickable(
                        (By.XPATH, CommonLocators.TRANSAFORMATION1)))
                element.click()
                time.sleep(2)
                if 'str' in line:
                    break
Пример #3
0
 def select_customer(self, v_customer_type, v_customer_name):
     self.log.log_to_file("INFO", "Executing TransactionTrackerOperations.select_customer()")
     selenium_operations_object = SeleniumOperations(self.v_task_type, self.driver, self.log)
     time.sleep(2)
     if v_customer_type == "Company":
         selenium_operations_object.send_text_by_xpath(LocalElementLocator.COMPANY_SEARCH_INPUTBOX, v_customer_name)
     if v_customer_type == "Trading Partner":
         selenium_operations_object.send_text_by_xpath(LocalElementLocator.TRADING_SEARCH_INPUTBOX, v_customer_name)
     time.sleep(2)
     count = self.driver.find_elements_by_xpath(LocalElementLocator.DROP_DOWN_LIST)
     for i in range(len(count)):
         if v_customer_type == "Company":
             v_customer_from_TT = selenium_operations_object .get_text_by_xpath(LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_1 + str(
                 i) + LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_2)
         if v_customer_type == "Trading Partner":
             v_customer_from_TT = selenium_operations_object .get_text_by_xpath(
                 LocalElementLocator.CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_1 + str(
                     i) + LocalElementLocator.CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_2)
         if v_customer_name.lower() == v_customer_from_TT.lower():
             if v_customer_type == "Company":
                 selenium_operations_object.click_element_by_xpath(LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_1 + str(
                     i) + LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_2)
             if v_customer_type == "Trading Partner":
                 selenium_operations_object.click_element_by_xpath(LocalElementLocator.CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_1 + str(
                     i) + LocalElementLocator.CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_2)
             break
     time.sleep(2)
 def get_receiver_name(self, index):
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     #receiver_path = '//*[@id="form1:table1:' + str(index) + ':outputText17"]'
     receiver_path = '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(
         index) + ']/td[7]'
     if so.check_exists_by_xpath(receiver_path):
         return so.get_text_by_xpath(receiver_path)
     else:
         return False
 def get_receiver_name(self, v_index):
     selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                    self.v_driver,
                                                    self.log_file_object)
     v_receiver_path = '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(
         v_index) + ']/td[7]'
     if selenium_operation_object.check_exists_by_xpath(v_receiver_path):
         return selenium_operation_object.get_text_by_xpath(v_receiver_path)
     else:
         return False
    def get_ticket_uid(self, index):
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        #ticket_uid_path = '//*[@id="form1:table1:'+str(index)+':commandLink1"]'
        ticket_uid_path = '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(
            index) + ']/td[3]'

        if so.check_exists_by_xpath(ticket_uid_path):
            return so.get_text_by_xpath(ticket_uid_path)
        else:
            return False
    def __init__(self, task_type, lo, username, v_Browser):

        self.v_input_wb = openpyxl.load_workbook(
            ElementLocators.INPUT_FILE_PATH)
        self.v_task_type = task_type
        self.v_input_sheet = self.v_input_wb.get_sheet_by_name("Input")
        self.log = lo
        self.v_username = username
        self.v_Browser = v_Browser
        self.so = SeleniumOperations(self.v_task_type, self.v_Browser,
                                     self.log)
    def error_status(self, parcel_uid, error_title):
        self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
        time.sleep(3)
        link = 'https://commerce.spscommerce.com/transaction-tracker/prod/transactions/' + parcel_uid + '/'
        self.v_driver.get(link)
        time.sleep(15)
        self.v_driver.switch_to.frame(0)
        time.sleep(2)

        selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                       self.v_driver,
                                                       self.log_file_object)
        time.sleep(2)
        if error_title == LocalElementLocator.ADHOC_ERROR_TITLE:

            path = '//*[@id="parcel-' + parcel_uid + '"]/div[2]/div/div/div[2]/form/div/button[2]'
            if not selenium_operation_object.check_exists_by_xpath(path):
                time.sleep(2)
                self.v_driver.get(link)
                time.sleep(10)
                self.v_driver.switch_to.frame(0)
                time.sleep(2)
                if not selenium_operation_object.check_exists_by_xpath(path):
                    return 0

            selenium_operation_object.click_element_by_xpath(path)
            i = 1
            while (1):

                path1 = '/html/body/app-reporting/div/div/div/div/div[2]/div/section/div[2]/div[2]/div[' + str(
                    i) + ']'
                temp = selenium_operation_object.get_text_by_xpath(path1)
                time.sleep(1)
                if parcel_uid in temp:
                    ans = self.v_driver.find_element_by_xpath(
                        '/html/body/app-reporting/div/div/div/div/div[2]/div/section/div[2]/div[2]/div['
                        + str(i + 1) + ']').text
                    id = ans.split('AdhocReporting ')[1]
                    id = id.split('\n')[0]
                    break
                i = i + 1

            selenium_operation_object.click_element_by_xpath(
                '//*[@id="parcel-' + id + '"]/div/div/div[1]/a/span/i[2]')
            status = selenium_operation_object.get_text_by_xpath(
                '//*[@id="parcel-' + id +
                '"]/div/ng-include/div/div/div[1]/div/div[2]/dl/div[2]/dd')
            if status == 'Accepted':
                return 1
            else:
                return 0

        else:
            return 1
    def process(self, path):
        #tto = TransactionTrackerOperations
        print("in task filter method")
        #rf = ReportFileUtility(self.v_task_type)
        # self.v_input_sheet = self.v_input_wb.get_sheet_names("InputData")
        print("input data sheet selected")
        row_count = self.v_input_sheet.max_row
        print(row_count)
        eo = ExcelOperations(self.v_task_type, self.v_input_sheet)
        supplier_name = self.v_input_sheet.cell(row=2, column=1).value
        retailer_name = self.v_input_sheet.cell(row=2, column=2).value
        doc_type = self.v_input_sheet.cell(row=2, column=3).value
        date = self.v_input_sheet.cell(row=2, column=4).value
        ptfu = Process_Test_Files_Utility(self.v_task_type, self.v_driver,
                                          self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        time.sleep(3)
        self.v_driver.switch_to.frame(0)
        ptfu.search_by_names(supplier_name, retailer_name, doc_type, date)
        # ptfu.search_by_names("AURORA ORGANIC","Topco","850","09/20/2018")
        ptfu.get_five_parcels()

        path = 'D:\processtestfiles.txt'

        with open(path) as f:
            for line in f:
                parcel = line.replace('\n', '')
                print("Download Parcel ID : " + str(parcel))
                #self.v_driver.switch_to.frame(0)
                ptfu.search_by_parcel_id(str(parcel))

                #generated_parcel_id = ptfu.save_page_source_and_generate_parcel_id_from_dom()

                #xpath_for_click = ptfu.generate_xpath_for_TT(generated_parcel_id)

                so.click_element_by_xpath(
                    "//aside[text()='Transformations']/following::a[@title='View'][1]/div/div"
                )
                # time.sleep(1)
                # downloaded_parcel=so.get_text_by_xpath("//aside[text()='Transformations']/following::a[@title='View'][1]/div/div/following::span[2]")
                # downloaded_parcel_path="C:\\Users\\yogesh.pawar\\Downloads\\"+downloaded_parcel+".dat"
                # copy_to_path="D:\\ProcessTestFiles"
                element = WebDriverWait(self.v_driver, 20).until(
                    EC.element_to_be_clickable((
                        By.XPATH,
                        "html/body/div[1]/section/section/div/div/section/div/div[3]/div[1]/div/div[1]/div/div/div/a/i"
                    )))
                element.click()
                time.sleep(2)
                # shutil.copy(downloaded_parcel_path, copy_to_path)

                if 'str' in line:
                    #time.sleep(4)
                    break
Пример #10
0
 def click_on_profile_name_via_relationships(self):
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     searched_profiles_relationships = so.list_elements_by_xpath(
         LocalElementLocator.DC4_PREPROD_SEARCH_TABLE_CONTENT_TR)
     count_searched_profiles_relationships = len(
         searched_profiles_relationships)
     print(count_searched_profiles_relationships)
     if count_searched_profiles_relationships != 2:
         return
     else:
         so.click_element_by_xpath(
             LocalElementLocator.DC4_PREPROD_RELATIONSHIPS_PROFILE_NAME)
    def select_customer(self, customer_type, customer_name):
        #self.driver.switch_to.frame(0)
        self.lo.log_to_file(
            "INFO",
            "Executing method 'select_customer' from TransactionTrackerOperations"
        )
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        print("Search for: " + str(customer_name))

        time.sleep(2)
        # driver.switch_to.frame(0)
        if customer_type == "Company":
            # self.driver.switch_to.frame(0)
            so.send_text_by_xpath(
                "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[1]/div/div[1]/label/chosen-company/div/ul/li/input",
                customer_name)

        if customer_type == "Trading Partner":
            # self.driver.switch_to.frame(0)
            # TP_name = self.driver.find_element_by_xpath(
            #     "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[1]/div/div[4]/label/chosen-trading-partner/div/ul/li/input")
            # time.sleep(2)
            print("================================" + customer_name)
            so.send_text_by_xpath(
                "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[1]/div/div[4]/label/chosen-trading-partner/div/ul/li/input",
                customer_name)
            # driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[1]/div/div[4]/label/chosen-trading-partner/div/ul").click()
        #TP_name.send_keys(customer_name)

        time.sleep(3)
        count = self.v_driver.find_elements_by_xpath(
            ".//*[contains(@id,'ui-select-choices-row-')]")
        for i in range(len(count)):
            if customer_type == "Company":
                customer_from_TT = self.v_driver.find_element_by_xpath(
                    ".//*[@id='ui-select-choices-row-0-" + str(i) + "']").text
            if customer_type == "Trading Partner":
                customer_from_TT = self.v_driver.find_element_by_xpath(
                    ".//*[@id='ui-select-choices-row-1-" + str(i) + "']").text
            if customer_name == customer_from_TT:
                if customer_type == "Company":
                    so.click_element_by_xpath(
                        ".//*[@id='ui-select-choices-row-0-" + str(i) + "']")
                    #self.driver.find_element_by_xpath(".//*[@id='ui-select-choices-row-0-" + str(i) + "']").click()
                if customer_type == "Trading Partner":
                    so.click_element_by_xpath(
                        ".//*[@id='ui-select-choices-row-1-" + str(i) + "']")
                    #self.driver.find_element_by_xpath(".//*[@id='ui-select-choices-row-1-" + str(i) + "']").click()
                print("Found matching customer name at position: " +
                      str(i + 1))
        time.sleep(2)
    def search_by_parcel_id(self, parcel_id):
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        print("in search_by_parcel_id method")
        self.v_driver.get(
            "https://commerce.spscommerce.com/transaction-tracker/prod/transactions/"
        )
        time.sleep(4)
        self.v_driver.switch_to.frame(0)
        # parcel_id_textbox = self.driver.find_element_by_xpath(
        #     "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/label/div/div[2]/input")
        so.send_text_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/label/div/div[2]/input",
            parcel_id)

        # parcel_id_textbox.send_keys(parcel_id)
        time.sleep(4)
        # search_btn = self.driver.find_element_by_xpath(
        #     "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/button")
        so.click_element_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/button"
        )

        # search_btn.click()
        time.sleep(4)
        first_parcel_id = self.v_driver.find_element_by_xpath(
            ".//*[@id='parentTablesContainer']/div[1]/table/tbody/tr/td[2]/span/a "
        )
        so.click_element_by_xpath(
            ".//*[@id='parentTablesContainer']/div[1]/table/tbody/tr/td[2]/span/a"
        )

        #first_parcel_id.click()
        time.sleep(3)
Пример #13
0
    def __init__(self, task_type, lo, username,v_Browser):

        self.v_input_wb = openpyxl.load_workbook(ElementLocators.INPUT_FILE_PATH)
        self.v_task_type = task_type
        self.v_input_sheet = self.v_input_wb.get_sheet_by_name("Input")
        self.v_input_sheet_maps = self.v_input_wb.get_sheet_by_name("Maps")
        self.v_input_sheet_Adaptor_Data_Type_ID = self.v_input_wb.get_sheet_by_name("Adaptor Data Type ID")
        self.log = lo
        self.v_username = username
        self.v_Browser=v_Browser
        self.so = SeleniumOperations(self.v_task_type, self.v_Browser, self.log)
        self.login_operations_object = Login(self.v_task_type, self.v_Browser, self.v_input_wb, self.log)
        self.so = SeleniumOperations(self.v_task_type, self.v_Browser, self.log)
        self.login_operations_object.login("Launchpad")
        self.login_operations_object.login("DC4 Prod")
Пример #14
0
 def execute_main(self):
     self.lo.log_to_file("INFO",
                         "Executing Process_Test_Files.execute_main()")
     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)
     self.v_data_sheet = self.v_input_wb.get_sheet_by_name(
         'PROCESS_TEST_FILES_INPUT')
     total_rows = self.v_data_sheet.max_row
     lg.login("Launchpad")
     self.v_driver.maximize_window()
     self.v_driver.execute_script("window.open('about:blank', 'tab2');")
     self.v_driver.switch_to.window("tab2")
     lg.login("DC4 PreProd")
     self.v_driver.execute_script("window.open('about:blank', 'tab3');")
     self.v_driver.switch_to.window("tab3")
     lg.login("FTP Pre-prod")
     for row_count in range(2, total_rows + 1):
         v_supplier = self.v_data_sheet.cell(row=row_count, column=1).value
         v_retailer = self.v_data_sheet.cell(row=row_count, column=2).value
         v_doc_type = self.v_data_sheet.cell(row=row_count, column=3).value
         v_date = self.v_data_sheet.cell(row=row_count, column=4).value
         if v_doc_type == CommonLocators.PO_File:
             ptf_850 = Process_Test_file_850(self.v_task_type, self.lo,
                                             self.v_username,
                                             self.v_input_wb, self.v_driver)
             ptf_850.execute_main(v_supplier, v_retailer, v_doc_type,
                                  row_count, v_date)
         else:
             self.lo.log_to_file(
                 "ERROR",
                 "Document is not found in Process_Test_Files.execute_main()"
             )
    def get_parcel(self, input_sheet,row):
        self.lo.log_to_file("INFO", "Executing method 'get_parcel' from TransactionTrackerOperations")
        so = SeleniumOperations(self.v_task_type, self.driver, self.lo)
        eo = ExcelOperations(self.v_task_type, input_sheet)
        comment = ' '
        #print("========================================================================================")
        parcel_count = int(self.driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/spsui-feedback-container[4]/result-feedback/div/div/div/div[1]/strong").text)
        print("Total unique parcel count is: "+str(parcel_count))
        for i in range (parcel_count):
            document_id=self.driver.find_element_by_xpath(".//*[@id='parentTablesContainer']/div[2]/table/tbody[1]/tr["+str(i+1)+"]/td[5]").text
            status=self.driver.find_element_by_xpath(".//*[@id='parentTablesContainer']/div[2]/table/tbody[1]/tr["+str(i+1)+"]/td[1]").text
            parcel_ID=self.driver.find_element_by_xpath(".//*[@id='parentTablesContainer']/div[1]/table/tbody/tr["+str(i+1)+"]/td[2]/span/a").text

            print(str(i+1)+") Parcel ID: "+str(parcel_ID)+" (Document ID: "+str(document_id)+") with status: "+str(status))
            comment=comment+str(i+1)+") Parcel ID: "+str(parcel_ID)+" (Document ID: "+str(document_id)+") with status: "+str(status)+"\n"
            if "CM" in document_id:
                eo.set_value(row, 8, "Data found for CREDIT MEMO")

                #comment=comment+"Credir Memo not found in Search result"+"\n"
                #comment = comment + str(i + 1) + ") Parcel ID: " + str(parcel_ID) + " (Document ID: " + str(document_id) + ") with status: " + str(status)

        #print("========================================================================================")
        eo.set_value(row,6,parcel_count)
        eo.set_value(row, 7, comment)
        self.driver.get("https://commerce.spscommerce.com/transaction-tracker/prod/transactions/")
        #so.click_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/a")
        time.sleep(5)
Пример #16
0
    def execute_main(self):
            v_start_time = time.time()
            self.lo.log_to_file("INFO", "Login in to DC4 Pre-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)
            input_sheet = self.v_input_wb.get_sheet_by_name('Input')

            #HardCoded Location
            current_row = 2
            Company_Name = input_sheet.cell(row=current_row, column=1).value
            Retailer_Name=input_sheet.cell(row=current_row,column=2).value
            Capability_UID=input_sheet.cell(row=current_row,column=5).value

            #Login to DC4 Pre-Production
            lg.login("DC4 PreProd")

            #Entering & Searching DC4 Company
            dc4_common_dc4_utility_object = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
            dc4_common_dc4_utility_object.company_search_by_name(Company_Name)

            #Clicking on Searched Company Name, Relationships Tab
            dc4_local_dc4_utility_local_object=DC4_Utility_Local(self.v_task_type, self.v_driver, self.lo, self.v_input_wb)
            dc4_local_dc4_utility_local_object.click_on_searched_company_name()
            dc4_local_dc4_utility_local_object.add_new_capability()
            dc4_local_dc4_utility_local_object.return_capability_uid()
            dc4_local_dc4_utility_local_object.click_on_preprod_relationships_tab()
            dc4_local_dc4_utility_local_object.search_trading_partner_name_in_relationships(Retailer_Name)
            dc4_local_dc4_utility_local_object.click_on_profile_name_via_relationships()
            dc4_local_dc4_utility_local_object.click_on_show_link_of_searched_profile()
            dc4_local_dc4_utility_local_object.add_existing_capability()

            time.sleep(10)
    def add_extensions(self, counter):

        # Get the versions of the supplier and retailer from Input sheet
        eo = ExcelOperations(self.v_task_type, self.v_data_sheet)

        supplier_map_version = self.v_data_sheet.cell(row=counter,
                                                      column=9).value
        retailer_map_version = self.v_data_sheet.cell(row=counter,
                                                      column=10).value

        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)

        version_check = msgbox("Supplier_Version" + supplier_map_version +
                               "             " + "Retailer_Version" +
                               retailer_map_version)

        # # print(self.v_driver.current_window_handle)
        # if  so.check_exists_by_xpath(V_configure_extensions_xpath):
        #     so.click_element_by_xpath(V_configure_extensions_xpath)
        #     time.sleep(1)
        #     self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
        #     time.sleep(1)
        #     self.v_driver.switch_to.frame(0)
        #     self.lo.log_to_file("INFO", "Checking the extensions")

        self.v_driver.switch_to.window(self.v_driver.window_handles[0])
    def search_process_for_PDM(self,supplier,retailer,doc_type,date, input_sheet,row):

        print("=====================================Task Number: "+str(row)+"===================================")
        print("============================================================================================")
        self.lo.log_to_file("INFO", "Executing method 'search_process' from TransactionTrackerOperations")
        self.driver.switch_to.frame(0)
        so = SeleniumOperations(self.v_task_type, self.driver, self.lo)
        self.select_customer("Company",supplier)
        self.select_customer("Trading Partner",retailer)

        start_date = self.driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[2]/div/div[2]/div/div/div[1]/label/input")
        time.sleep(2)
        start_date.clear()
        start_date.send_keys(date)
        time.sleep(2)
        service=self.driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[1]/label/select")
        service.send_keys("DC4Router")
        time.sleep(2)
        document_type=self.driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[3]/label/input")
        document_type.send_keys(doc_type)
        time.sleep(2)
        search_btn = self.driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/button")
        search_btn.click()
        time.sleep(3)
        clear_btn = self.driver.find_element_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/a")
        #clear_btn.click()
        self.get_parcel(input_sheet,row)
 def search_by_parcel_id_and_download(self, parcel_id):
     self.create_file_save_path("supplier", "retailer")
     print("search_by_parcel_id_and_download method")
     self.driver.get(LocalElementLocator.TRANSACTION_TRACKER_PROD_LINK +
                     parcel_id)
     so = SeleniumOperations(self.v_task_type, self.driver, self.lo)
     time.sleep(1)
     self.driver.switch_to.frame(0)
     time.sleep(1)
     PARCEL_FIRST_STAGE_ID = so.get_text_by_xpath(
         LocalElementLocator.PARCEL_FIRST_STAGE_ID)
     self.driver.get(LocalElementLocator.TRANSACTION_TRACKER_PROD_LINK +
                     parcel_id + "/parcel/" + PARCEL_FIRST_STAGE_ID)
     time.sleep(2)
     self.driver.switch_to.frame(0)
     so.click_element_by_xpath(LocalElementLocator.DOWNLOAD_LOGO_BUTTON)
     time.sleep(3)
    def login_to_sailpoint(self):
        print("login_to_sailpoint")
        so = SeleniumOperations(self.v_task_type, self.v_Browser, self.log)

        self.v_Browser.get(ElementLocators.SALESFORCE_URL)
        so.click_element_by_xpath(".//*[@id='idp_section_buttons']/button[2]")
        # so.click_element_by_xpath(".//*[@id='cancel_idp_hint']")#Log In with a Different Account link
        # so.click_element_by_xpath(".//*[contains(text(),'SailPoint')]")
        # so.click_element_by_xpath(ElementLocators.SAILPOINT_BTN)
        # self.v_Browser.get("https://iam.spscommerce.com/login/login?spEntityID=https%3A%2F%2Fspscommerce.my.salesforce.com&goto=https%3A%2F%2Fiam-sso.spscommerce.com%2Fsso%2FSSORedirect%2FmetaAlias%2Fspscommerce%2Fidp%3FReqID%3D_2CAAAAXCfPa15ME8wMGcwMDAwMDA0Qzk4AAAA3kV67IWmbs12h6m088CMAf07tJcrGOLzEuC6k0Aq2epzV0oaRieDf2U4LBX0Ve0lPuXoZm0y4nxzD4vTrqr7X4mue0_5qLojuNHUxFCj61_mB3PZQj97LDNHpjxkZunTSBRH90cSn5xydi1kFAyU8PVF4s8BKuzm6j8kJzse7O_CephJERN1e6PoPj0VKwaWkFnvGnr-YNZyL64Uy3nUyttHGaMkHw4OYrepEuTK31x1D7qp0MwTmiK2l4_ZqOdVBw%26index%3Dnull%26acsURL%3Dhttps%253A%252F%252Fspscommerce.my.salesforce.com%253Fso%253D00D300000000bzv%26spEntityID%3Dhttps%253A%252F%252Fspscommerce.my.salesforce.com%26binding%3Durn%253Aoasis%253Anames%253Atc%253ASAML%253A2.0%253Abindings%253AHTTP-POST")
        # time.sleep(2)
        # self.v_Browser.get("https://iam.spscommerce.com/login/login?spEntityID=https%3A%2F%2Fspscommerce.my.salesforce.com&goto=https%3A%2F%2Fiam-sso.spscommerce.com%2Fsso%2FSSORedirect%2FmetaAlias%2Fspscommerce%2Fidp%3FReqID%3D_2CAAAAXCfPa15ME8wMGcwMDAwMDA0Qzk4AAAA3kV67IWmbs12h6m088CMAf07tJcrGOLzEuC6k0Aq2epzV0oaRieDf2U4LBX0Ve0lPuXoZm0y4nxzD4vTrqr7X4mue0_5qLojuNHUxFCj61_mB3PZQj97LDNHpjxkZunTSBRH90cSn5xydi1kFAyU8PVF4s8BKuzm6j8kJzse7O_CephJERN1e6PoPj0VKwaWkFnvGnr-YNZyL64Uy3nUyttHGaMkHw4OYrepEuTK31x1D7qp0MwTmiK2l4_ZqOdVBw%26index%3Dnull%26acsURL%3Dhttps%253A%252F%252Fspscommerce.my.salesforce.com%253Fso%253D00D300000000bzv%26spEntityID%3Dhttps%253A%252F%252Fspscommerce.my.salesforce.com%26binding%3Durn%253Aoasis%253Anames%253Atc%253ASAML%253A2.0%253Abindings%253AHTTP-POST")
        # self.v_Browser.get("https://iam.spscommerce.com/login/login?spEntityID=https%3A%2F%2Fspscommerce.my.salesforce.com&goto=https%3A%2F%2Fiam-sso.spscommerce.com%2Fsso%2FSSORedirect%2FmetaAlias%2Fspscommerce%2Fidp%3FReqID%3D_2CAAAAXCfPa15ME8wMGcwMDAwMDA0Qzk4AAAA3kV67IWmbs12h6m088CMAf07tJcrGOLzEuC6k0Aq2epzV0oaRieDf2U4LBX0Ve0lPuXoZm0y4nxzD4vTrqr7X4mue0_5qLojuNHUxFCj61_mB3PZQj97LDNHpjxkZunTSBRH90cSn5xydi1kFAyU8PVF4s8BKuzm6j8kJzse7O_CephJERN1e6PoPj0VKwaWkFnvGnr-YNZyL64Uy3nUyttHGaMkHw4OYrepEuTK31x1D7qp0MwTmiK2l4_ZqOdVBw%26index%3Dnull%26acsURL%3Dhttps%253A%252F%252Fspscommerce.my.salesforce.com%253Fso%253D00D300000000bzv%26spEntityID%3Dhttps%253A%252F%252Fspscommerce.my.salesforce.com%26binding%3Durn%253Aoasis%253Anames%253Atc%253ASAML%253A2.0%253Abindings%253AHTTP-POST")
        so.send_text_by_xpath(ElementLocators.SAILPOINT_USERNAME_TEXTBOX,
                              ElementLocators.SAILPOINT_CREDENTIAL_USENAME)
        so.send_text_by_xpath(ElementLocators.SAILPOINT_PASSWORD_TEXTBOX,
                              ElementLocators.SAILPOINT_CREDENTIAL_PASSWORD)
        so.click_element_by_xpath(ElementLocators.SAILPOINT_LOGIN_BTN)
Пример #21
0
 def Login_Launchpad(self,driver):
     so = SeleniumOperations(self.v_task_type, driver, self.log)
     driver.get(ElementLocators.TRANSACTION_TRACKER_PROD_LINK)
     time.sleep(7)
     driver.switch_to.frame(0)
     # driver.find_element_by_xpath(ElementLocators.tt_username).send_keys(ElementLocators.tt_uname)
     # time.sleep(5)
     so.send_text_by_xpath(ElementLocators.tt_username, ElementLocators.tt_uname)
     so.send_text_by_xpath(ElementLocators.tt_password, ElementLocators.tt_pw)
     so.click_element_by_xpath(ElementLocators.tt_login_btn)
     time.sleep(2)
 def execute_main(self):
     # self.v_driver = webdriver.Chrome(AppConstants.BROWSER_DRIVER)
     # self.v_driver.maximize_window()
     self.lo.log_to_file("INFO", "Login in to Launchpad")
     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)
     time.sleep(5)
     print("Browser opened,login,open TT")
     self.process(self.v_input_wb)
     print("Task filter completed")
 def get_unique_doc_types(self, v_doc_type):
     list_doc_type = []
     list_doc_type.append(v_doc_type)
     selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                    self.v_driver,
                                                    self.log_file_object)
     v_index = 2
     while (1):
         v_path = '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(
             v_index) + ']/td[8]/text()[1]'
         if selenium_operation_object.check_exists_by_xpath(v_path):
             if v_doc_type != selenium_operation_object.get_text_by_xpath(
                     v_path):
                 list_doc_type.append(
                     selenium_operation_object.get_text_by_xpath(v_path))
         else:
             break
         v_index = v_index + 1
     return list_doc_type
    def execute_main(self):

        print('in main method of PDM')

        self.v_driver = webdriver.Chrome(AppConstants.BROWSER_DRIVER)
        self.v_driver.maximize_window()

        self.lo.log_to_file("INFO", "Login in to Launchpad")
        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)
        print("asdasdsad")
        lg.login("Launchpad")
        time.sleep(5)
        self.v_driver.get(LocalElementLocator.TRANSACTION_TRACKER_PROD_LINK)
        time.sleep(5)
        if so.check_clickable_by_xpath(
                "html/body/app-reporting/div/div/nav-bar/div/nav"):
            print("Element clickable")
        else:
            print("Not clickable")
    def search_by_names(self, supplier, retailer, doc_type, date):
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)

        print("in search_by_names method")
        self.select_customer("Company", supplier)
        time.sleep(3)
        self.select_customer("Trading Partner", retailer)
        time.sleep(2)

        so.send_text_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[2]/div/div[2]/div/div/div[1]/label/input",
            date)

        time.sleep(2)

        time.sleep(2)
        service = self.v_driver.find_element_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[1]/label/select"
        )
        #so.send_text_by_xpath("html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[1]/label/select", "DC4Router")
        service.send_keys("DC4Router")

        so.send_text_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[3]/label/input",
            doc_type)

        search_btn = self.v_driver.find_element_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/button"
        )
        search_btn.click()
        #time.sleep(3)
        clear_btn = self.v_driver.find_element_by_xpath(
            "html/body/div[1]/section/section/div/div/section/div/div[1]/div[2]/div[5]/div/a"
        )
Пример #26
0
 def search_trading_partner_name_in_relationships(self, retailer_name):
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     so.send_text_by_xpath(
         LocalElementLocator.DC4_PREPROD_TRADING_PARTNER_NAME_TEXTFIELD,
         retailer_name)
     so.click_element_by_xpath(
         LocalElementLocator.DC4_PREPROD_SEARCH_BUTTON)
Пример #27
0
    def download_first_parcel(self):
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        time.sleep(4)

        first_parcel_id = self.driver.find_element_by_xpath(
            ".//*[@id='parentTablesContainer']/div[1]/table/tbody/tr/td[2]/span/a"
        )

        first_parcel_id.click()
        time.sleep(2)
        file = open("D://TTcode.txt", "w+")
        file.write(self.driver.page_source)
        print(file.read())
    def select_customer(self, customer_type, customer_name):
        self.lo.log_to_file(
            "INFO",
            "Executing method 'select_customer' from TransactionTrackerOperations"
        )
        so = SeleniumOperations(self.v_task_type, self.driver, self.lo)
        print("Search for: " + str(customer_name))
        time.sleep(2)
        if customer_type == "Company":
            time.sleep(1)

            self.driver.find_element_by_xpath(
                LocalElementLocator.COMPANY_SEARCH_INPUTBOX).send_keys(
                    customer_name)
        if customer_type == "Trading Partner":
            TP_name = self.driver.find_element_by_xpath(
                LocalElementLocator.TRADING_SEARCH_INPUTBOX)
            time.sleep(2)
            TP_name.send_keys(customer_name)
        time.sleep(2)
        count = self.driver.find_elements_by_xpath(
            LocalElementLocator.DROP_DOWN_LIST)
        for i in range(len(count)):
            if customer_type == "Company":
                customer_from_TT = self.driver.find_element_by_xpath(
                    LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_1 +
                    str(i) +
                    LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_2).text
            if customer_type == "Trading Partner":
                customer_from_TT = self.driver.find_element_by_xpath(
                    LocalElementLocator.CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_1
                    + str(i) +
                    LocalElementLocator.CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_2
                ).text
            if customer_name.lower() == customer_from_TT.lower():
                if customer_type == "Company":
                    self.driver.find_element_by_xpath(
                        LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_1 +
                        str(i) +
                        LocalElementLocator.CUSTOMER_FROM_TT_FOR_COMPANY_2
                    ).click()
                if customer_type == "Trading Partner":
                    self.driver.find_element_by_xpath(
                        LocalElementLocator.
                        CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_1 + str(i) +
                        LocalElementLocator.
                        CUSTOMER_FROM_TT_FOR_TRADING_PARTNER_2).click()
                print("Found matching customer name at position: " +
                      str(i + 1))
                break
        time.sleep(2)
 def Download_processFile(self):
     selenium_operations_object = SeleniumOperations(self.driver, self.log)
     # tt_first_parcel = selenium_operations_object.get_text_by_xpath(ElementLocator.parcel_1_click)
     # tt_second_parcel = selenium_operations_object.get_text_by_xpath(ElementLocator.parcel_2_click)
     # tt_third_parcel = selenium_operations_object.get_text_by_xpath(ElementLocator.parcel_3_click)
     selenium_operations_object.click_element_by_xpath(
         ElementLocator.parcel_1_click)
     self.get_parcel("1")
     # selenium_operations_object.send_text_by_xpath(ElementLocator.search_parcel,tt_second_parcel)
     selenium_operations_object.click_element_by_xpath(
         ElementLocator.parcel_2_click)
     self.get_parcel("2")
     selenium_operations_object.click_element_by_xpath(
         ElementLocator.parcel_3_click)
     self.get_parcel("3")
    def execute_main(self):
        # self.lo.log_to_file("INFO", "Login in to DC4 Pre_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)
        self.v_data_sheet = self.v_input_wb.get_sheet_by_name('PROCESS_TEST_FILES_INPUT')

        total_rows = self.v_data_sheet.max_row
        self.v_driver.maximize_window()
        lg.login("Launchpad")
        time.sleep(3)
        self.v_driver.get("https://commerce.spscommerce.com/transaction-tracker/prod/transactions/")
        time.sleep(5)
        tto=TransactionTrackerOperations(self.v_task_type, self.v_driver, self.lo)

        # tto.search_process_for_process_test_file("Spring Silver Foods Inc","C&S Wholesale","850","10/02/2018")
        tto.search_by_parcel_id_and_download("10944250370")