示例#1
0
    def test_FlowOrderShippingApply(self):

        su = self.loadvendername()
        ad = self.loadvendernames()
        for i in range(0, len(su)):
            print(su[i][0])
            print(su[i][1])
        self.login(su[0][0], su[0][1])
        #self.login('carla','123')
        sleep(5)

        # 关闭弹出框
        self.driver.find_element_by_xpath(
            "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
        ).click()

        sleep(2)

        # 定位到申请单据
        self.driver.find_element_by_xpath(
            "//*[@id='appNavTabPanel']//span[contains(@class,'fa-code-fork')]"
        ).click()

        sleep(2)

        # 定位到船务类
        self.driver.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '船务类')]"
        ).click()

        sleep(3)

        # 定位到订单发货确认
        self.driver.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '订单发货确认')]"
        ).click()

        sleep(2)

        # 定位到订单发货确认新建
        self.driver.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationView']//span[contains(@class,'fa-plus')]"
        ).click()

        sleep(2)

        # 定位添加订单信息按钮'''
        _elementFirst = self.driver.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationFormGridPanelID_header-targetEl']//img[contains(@class,'x-tool-plus')]"
        )

        sleep(2)

        ActionChains(self.driver).double_click(_elementFirst).perform()

        sleep(2)

        if ad[0] != '':
            # 点击确认
            self.driver.find_element_by_xpath(
                "//*[@id='OrderShippingPlanDialogWinID']//input[contains(@name,'keywords')]"
            ).send_keys(ad[0])

            sleep(2)

            # 点击确认
            self.driver.find_element_by_xpath(
                "//*[@id='OrderShippingPlanDialogWinID']//span[contains(@class,'fa-search')]"
            ).click()

            _elementFiveth = (random.randint(0, 0))

            # 定位订单第一条记录
            _elementSecond = self.driver.find_element_by_xpath(
                "//*[@id='OrderShippingPlanDialogWinGridPanelID-body']//tr[@data-recordindex={}]"
                .format(_elementFiveth))

            sleep(2)

            # 在此元素上双击
            ActionChains(self.driver).double_click(_elementSecond).perform()

        else:
            _elementFiveth = (random.randint(0, 10))

            # 定位订单第一条记录
            _elementSecond = self.driver.find_element_by_xpath(
                "//*[@id='OrderShippingPlanDialogWinGridPanelID-body']//tr[@data-recordindex={}]"
                .format(_elementFiveth))

            sleep(2)

            # 在此元素上双击
            ActionChains(self.driver).double_click(_elementSecond).perform()

        sleep(2)

        # 点击确认
        self.driver.find_element_by_xpath(
            "//*[@id='OrderShippingPlanDialogWinID']//span[contains(@class,'fa-check')]"
        ).click()

        sleep(2)

        # 点击发启
        self.driver.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class,'fa-play')]"
        ).click()

        self.driver.implicitly_wait(30)
        # 获取弹窗提示:
        self.driver.implicitly_wait(10)
        a = self.driver.find_element_by_css_selector(
            '.x-box-mc').get_attribute('textContent')
        print(a)

        sleep(10)

        self.driver.find_element_by_link_text('注销').click()  # 点击注销

        self.driver.find_element_by_link_text('是').click()

        if self.is_alert_present():

            alert = self.driver.switch_to_alert()

            alert.accept()  # 退出页面

        else:
            pass

        sleep(5)

        self.login(su[1][0], su[1][1])

        sleep(5)

        # 关闭弹出框
        self.driver.find_element_by_xpath(
            "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
        ).click()

        sleep(2)

        # 定位到工作面板
        self.driver.find_element_by_xpath(
            "//*[@id='appNavTabPanel']//span[contains(@class,'fa-desktop')]"
        ).click()

        sleep(2)

        # 定位到待办事项
        self.driver.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '待办事项')]"
        ).click()

        sleep(2)

        # 定位到待办事项第一条记录
        self.driver.find_element_by_xpath(
            "//*[@id='EventsGridPanelID-body']//div[contains(text(), '1')]"
        ).click()

        sleep(2)

        # 点击马上处理
        self.driver.find_element_by_xpath(
            "//*[@id='EventsFormPanelID-body']//span[contains(@class, 'x-btn-icon-el')]"
        ).click()

        sleep(2)

        # 定位iframe
        self.driver.switch_to.frame(
            self.driver.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationMainTabsPanelID-win-body']//iframe[contains(@class,'cke_wysiwyg_frame cke_reset')]"
            ))

        sleep(2)

        # 输入内容
        self.driver.find_element_by_class_name("cke_show_borders").send_keys(
            'test')

        sleep(2)

        # 退出iframe
        self.driver.switch_to.default_content()

        # 点击作废
        self.driver.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class, 'flowcancel')]"
        ).click()

        sleep(3)

        self.driver.find_element_by_link_text('是').click()

        sleep(2)

        self.driver.find_element_by_link_text('注销').click()  # 点击注销

        self.driver.find_element_by_link_text('是').click()

        if self.is_alert_present():

            alert = self.driver.switch_to_alert()

            alert.accept()  # 退出

        else:
            pass

        sleep(5)

        if handler.lower() == 'carla':

            self.login('Jack.L', '123')

            sleep(5)

            # 关闭弹出框
            self.driver.find_element_by_xpath(
                "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
            ).click()

            sleep(2)

            # 定位到工作面板
            self.driver.find_element_by_xpath(
                "//*[@id='appNavTabPanel']//span[contains(@class,'fa-desktop')]"
            ).click()

            sleep(2)

            # 定位到待办事项
            self.driver.find_element_by_xpath(
                "//*[@id='west-panel-targetEl']//span[contains(text(), '待办事项')]"
            ).click()

            sleep(2)

            # 定位到待办事项第一条记录
            self.driver.find_element_by_xpath(
                "//*[@id='EventsGridPanelID-body']//div[contains(text(), '1')]"
            ).click()

            sleep(2)

            # 点击马上处理
            self.driver.find_element_by_xpath(
                "//*[@id='EventsFormPanelID-body']//span[contains(@class, 'x-btn-icon-el')]"
            ).click()

            sleep(2)

            # 定位iframe
            self.driver.switch_to.frame(
                self.driver.find_element_by_xpath(
                    "//*[@id='FlowOrderShippingConfirmationMainTabsPanelID-win-body']//iframe[contains(@class,'cke_wysiwyg_frame cke_reset')]"
                ))

            sleep(2)

            # 输入内容
            self.driver.find_element_by_class_name(
                "cke_show_borders").send_keys('test')

            sleep(2)

            # 退出iframe
            self.driver.switch_to.default_content()

            # 点击作废
            self.driver.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class, 'flowcancel')]"
            ).click()

            sleep(3)

            self.driver.find_element_by_link_text('是').click()

            sleep(2)

        else:
            self.driver.quit()
示例#2
0
    def test_flow_service_provider_quotation(self):
        self.login('carla', '123')
        sleep(5)

        self.dr.find_element_by_xpath(
            "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
        ).click()  # 关闭弹出框

        self.dr.find_element_by_xpath(
            "//*[@id='appNavTabPanel']//span[contains(@class,'fa-code-fork')]"
        ).click()  # 定位到申请单据

        sleep(2)

        self.dr.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '船务类')]"
        ).click()  # 定位到船务类

        sleep(3)

        self.dr.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '服务商询价')]"
        ).click()  # 定位到服务商询价

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryView']//span[contains(@class,'fa-plus')]"
        ).click()  # 定位到服务商询价新建

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-body']//input[@name='main.serviceProviderName']"
        ).click()  ## 选择服务商编码

        _elementSecond = self.dr.find_element_by_xpath(
            "//*[@id='ServiceProviderDialogWinGridPanelID-body']//div[contains(text(), 'CUBE')]"
        )  # 定位订单第一条记录

        ActionChains(self.dr).double_click(_elementSecond).perform()  # 在此元素上双击

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-body']//input[@name='main.type']"
        ).click()  #报价类型

        self.dr.find_element_by_xpath(
            "//*[@class='x-list-plain']//li[contains(text(), '合同报价')]").click(
            )  # 选择合同报价

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-body']//input[@name='main.name']"
        ).send_keys('test')  # 报价名称

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-body']//input[@name='main.currencyAdjustment']"
        ).send_keys('0.01')  # 汇率调节

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-body']//input[@name='main.effectiveDate']"
        ).send_keys('2018-01-01')  # 生效日期

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-body']//input[@name='main.validUntil']"
        ).send_keys('2018-12-20')  # 失效日期

        self.dr.find_element_by_xpath(
            "//div[@id='FlowServiceInquiryViewFormPanelID-FlowServiceInquiryFreightMultiGrid-FlowServiceInquiryFreightMultiGridPanelID-normal-body']/div/table/tbody/tr[3]/td[9]/div"
        ).click()
        # 广州20gp海运

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryViewFormPanelID-FlowServiceInquiryFreightMultiGrid-FlowServiceInquiryFreightMultiFormPanelID-f-innerCt']//input[@name='priceGp20Aud']"
        ).send_keys('500')  # 广州20gp海运

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryForm']//span[contains(@class,'fa-play')]"
        ).click()  # 点击发启

        sleep(2)

        # 获取当前节点处理人

        handler = self.dr.find_element_by_xpath(
            "//div[@id='FlowServiceInquiryViewGridPanelID-body']/div/table/tbody/tr[1]/td[13]/div"
        ).text

        print(handler)

        self.dr.find_element_by_link_text('注销').click()  # 点击注销

        self.dr.find_element_by_link_text('是').click()

        alert = self.dr.switch_to_alert()

        alert.accept()  # 退出页面

        sleep(5)
        '''第一节点审核'''
        self.login(handler.lower(), '123')

        sleep(5)

        self.dr.find_element_by_xpath(
            "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
        ).click()  # 关闭弹出框

        self.dr.find_element_by_xpath(
            "//*[@id='appNavTabPanel']//span[contains(@class,'fa-desktop')]"
        ).click()  # 定位到工作面板

        self.dr.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '待办事项')]"
        ).click()  # 定位到待办事项

        self.dr.find_element_by_xpath(
            "//*[@id='EventsGridPanelID-body']//div[contains(text(), '1')]"
        ).click()  # 定位到待办事项第一条记录

        self.dr.find_element_by_xpath(
            "//*[@id='EventsFormPanelID-body']//span[contains(@class, 'x-btn-icon-el')]"
        ).click()  # 点击马上处理

        self.dr.find_element_by_xpath(
            "//*[@id='FlowServiceInquiryForm']//span[contains(@class, 'fa-check-square')]"
        ).click()  # 点击通过

        sleep(3)
    def test_order_shipping_apply(self):
        self.login('carla', '123')
        sleep(5)

        self.dr.find_element_by_xpath(
            "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
        ).click()  # 关闭弹出框

        self.dr.find_element_by_xpath(
            "//*[@id='appNavTabPanel']//span[contains(@class,'fa-code-fork')]"
        ).click()  # 定位到申请单据

        sleep(2)

        self.dr.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '船务类')]"
        ).click()  # 定位到船务类

        sleep(3)

        self.dr.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '订单发货确认')]"
        ).click()  # 定位到订单发货确认

        self.dr.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationView']//span[contains(@class,'fa-plus')]"
        ).click()  # 定位到订单发货确认新建

        _elementFirst = self.dr.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationFormGridPanelID_header-targetEl']//img[contains(@class,'x-tool-plus')]"
        )  # 定位添加订单信息按钮'''

        ActionChains(self.dr).double_click(_elementFirst).perform()

        _elementSecond = self.dr.find_element_by_xpath(
            "//*[@id='OrderShippingPlanDialogWinGridPanelID-body']//div[contains(text(), '1')]"
        )  # 定位订单第一条记录

        ActionChains(self.dr).double_click(_elementSecond).perform()  # 在此元素上双击

        self.dr.find_element_by_xpath(
            "//*[@id='OrderShippingPlanDialogWinID']//span[contains(@class,'fa-check')]"
        ).click()  #点击确认

        self.dr.find_element_by_xpath(
            "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class,'fa-play')]"
        ).click()  # 点击发启

        sleep(2)

        # 获取当前节点处理人

        handler = self.dr.find_element_by_xpath(
            "//div[@id='FlowOrderShippingConfirmationGridPanelID-body']/div/table/tbody/tr[1]/td[10]/div"
        ).text

        print(handler)

        self.dr.find_element_by_link_text('注销').click()  # 点击注销

        self.dr.find_element_by_link_text('是').click()

        if self.is_alert_present():

            alert = self.dr.switch_to_alert()

            alert.accept()  # 退出页面

        else:
            pass

        sleep(5)
        '''第一节点审核'''
        self.login(handler.lower(), '123')

        if OrderShippingApply.isElementExist(
                self,
                "//*[@id='appNavTabPanel']//span[contains(@class,'fa-code-fork')]"
        ):
            pass

        else:
            self.login(handler, '123')

        sleep(5)

        self.dr.find_element_by_xpath(
            "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
        ).click()  # 关闭弹出框

        self.dr.find_element_by_xpath(
            "//*[@id='appNavTabPanel']//span[contains(@class,'fa-desktop')]"
        ).click()  # 定位到工作面板

        self.dr.find_element_by_xpath(
            "//*[@id='west-panel-targetEl']//span[contains(text(), '待办事项')]"
        ).click()  # 定位到待办事项

        self.dr.find_element_by_xpath(
            "//*[@id='EventsGridPanelID-body']//div[contains(text(), '1')]"
        ).click()  # 定位到待办事项第一条记录

        self.dr.find_element_by_xpath(
            "//*[@id='EventsFormPanelID-body']//span[contains(@class, 'x-btn-icon-el')]"
        ).click()  # 点击马上处理

        # 判断是否需要分配处理人

        if self.dr.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationMainTabsPanelID-win-body']//input[@name='flowNextHandlerAccount']"
        ).is_displayed():  # 分配处理人

            self.dr.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationMainTabsPanelID-win-body']//input[@name='flowNextHandlerAccount']"
            ).click()  # 分配处理人

            self.dr.find_element_by_xpath(
                "//*[@class='x-list-plain']//li[contains(text(), 'Jack.L')]"
            ).click()  # 选择Jack.L

            self.dr.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class, 'fa-check-square')]"
            ).click()  # 点击通过

        else:
            self.dr.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class, 'fa-check-square')]"
            ).click()  # 点击通过

        sleep(3)

        self.dr.find_element_by_link_text('注销').click()  # 点击注销

        self.dr.find_element_by_link_text('是').click()

        if self.is_alert_present():

            alert = self.dr.switch_to_alert()

            alert.accept()  # 退出

        else:
            pass

        sleep(5)

        if handler.lower() == 'carla':

            self.login('Jack.L', '123')

            sleep(5)

            self.dr.find_element_by_xpath(
                "//*[@id='msgwin-div']//div[contains(@class,'x-tool-close')]"
            ).click()  # 关闭弹出框

            self.dr.find_element_by_xpath(
                "//*[@id='appNavTabPanel']//span[contains(@class,'fa-desktop')]"
            ).click()  # 定位到工作面板

            self.dr.find_element_by_xpath(
                "//*[@id='west-panel-targetEl']//span[contains(text(), '待办事项')]"
            ).click()  # 定位到待办事项

            self.dr.find_element_by_xpath(
                "//*[@id='EventsGridPanelID-body']//div[contains(text(), '1')]"
            ).click()  # 定位到待办事项第一条记录

            self.dr.find_element_by_xpath(
                "//*[@id='EventsFormPanelID-body']//span[contains(@class, 'x-btn-icon-el')]"
            ).click()  # 点击马上处理

            self.dr.find_element_by_xpath(
                "//*[@id='FlowOrderShippingConfirmationForm']//span[contains(@class, 'fa-check-square')]"
            ).click()  # 点击通过

            sleep(3)

        else:
            self.dr.quit()