Пример #1
0
 def back_to_comp_list_page(self):
     """
     :return:点击返回到帐套列表页面
     """
     publicPage = PublicPage(self.driver)
     link_loc = self.driver.find_element_by_link_text('帐套')
     publicPage.click_elem(link_loc)
Пример #2
0
 def click_operation_btn(self):
     page_url = self.driver.current_url
     print('[AccountDashbaordPage]--page_url=>', page_url)
     if '/app/home-page/accounting' in page_url:
         try:
             publicPage = PublicPage(self.driver)
             btn_loc = self.driver.find_element_by_xpath(operation_btn_elem)
             publicPage.click_elem(btn_loc)
             if publicPage.is_element_present(btn_drop_ite_elem):
                 print(
                     '[AccountDashbaordPage]click_operation_btn--点击下拉操作 成功--'
                 )
             else:
                 print(
                     '[AccountDashbaordPage]click_operation_btn--点击下拉操作 失败--'
                 )
                 exit()
         except Exception as e:
             print(
                 '[AccountDashbaordPage]click_operation_btn--点击下拉操作 失败--失败原因=>',
                 str(e))
             exit()
     elif '/app/home-page/assist' in page_url:
         print(
             '[AccountDashbaordPage]click_operation_btn--当前页面是助理首页,点击下拉操作 失败'
         )
     else:
         print('[AccountDashbaordPage]click_operation_btn--非助理/会计首页,操作失败!')
         exit()
Пример #3
0
    def select_category(self, category):
        try:
            if self.record_type == 'Income':
                category_drop_end_xpath_elem = income_category_drop_end_xpath_elem
            elif self.record_type == 'Outcome':
                category_drop_end_xpath_elem = outcome_category_drop_end_xpath_elem
            else:
                category_drop_end_xpath_elem = None
                print('类别定位失败!')

            public_page = PublicPage(self.driver)
            print(self.category_index(category))
            p_index = self.category_index(category)[0]
            c_index = self.category_index(category)[1]

            drop_loc = self.driver.find_element_by_xpath(
                page_base_xpath_elem + self.record_name +
                category_drop_end_xpath_elem)
            public_page.click_elem(drop_loc)

            parent_loc = self.driver.find_elements_by_css_selector(
                parent_elem)[p_index]
            public_page.click_elem(parent_loc)

            child_loc = self.driver.find_elements_by_css_selector(
                child_elem)[c_index]
            return public_page.click_elem(child_loc)
        except Exception as e:
            print(
                '[RevenueAndExpenditurePage] There was an exception when select_category=>',
                str(e))
Пример #4
0
 def click_logout_link(self):
     """
     :return: 点击退出系统按钮
     """
     publicPage = PublicPage(self.driver)
     link_loc = self.driver.find_element_by_link_text('退出')
     publicPage.click_elem(link_loc)
Пример #5
0
 def click_create_comp_btn(self):
     try:
         public_page = PublicPage(self.driver)
         btn_loc = self.driver.find_element_by_xpath(create_comp_btn_elem)
         public_page.click_elem(btn_loc)
     except Exception as e:
         print('[CompListPage]点击创建帐套按钮失败=>', str(e))
Пример #6
0
 def submit( self, btn_name ):
     """
     保存/取消
     :param btn_name: 按钮名称,可选值:保存、取消;
     :return:点击按钮;
     """
     if None != btn_name:
         if 'msg' in btn_name:
             if btn_name == 'msg_save':
                 btn_elem = msg_save_btn_elem
                 operation_name = '帐套信息保存'
             elif btn_name == 'msg_cancel':
                 btn_elem = msg_cancel_btn_elem
                 operation_name = '帐套信息取消'
             btn_loc = self.driver.find_element_by_id(btn_elem)
         elif 'create' in btn_name:
             if btn_name == 'create_save':
                 btn_elem = create_btn_elem
                 operation_name = '保存创建'
             elif btn_name == 'create_cancel':
                 btn_elem = cancel_btn_elem
                 operation_name = '取消创建'
             btn_loc = self.driver.find_element_by_xpath(btn_elem)
         public_page = PublicPage(self.driver)
         print('按钮名称:', operation_name)
         public_page.click_elem(btn_loc)
     else:
         return '无操作'
Пример #7
0
 def logout_current_company(self):
     """
     :return:点击退出当前帐套按钮
     """
     publicPage = PublicPage(self.driver)
     btn_loc = self.driver.find_element_by_xpath(comp_name_elem)
     publicPage.click_elem(btn_loc)
Пример #8
0
    def select_category(self, category):
        """
		:param category: 发票类别名
		"""
        try:
            publicPage = PublicPage(self.driver)
            print(self.category_index(category))
            p_index = self.category_index(category)[0]
            c_index = self.category_index(category)[1]

            drop_loc = self.driver.find_element_by_xpath(
                record_invoice_base_xpath + self.invoice_io +
                category_drop_elem)
            publicPage.click_elem(drop_loc)

            parent_loc = self.driver.find_elements_by_css_selector(
                parent_elem)[p_index]
            publicPage.click_elem(parent_loc)

            child_loc = self.driver.find_elements_by_css_selector(
                child_elem)[c_index]
            return publicPage.click_elem(child_loc)
        except Exception as e:
            print('[RecordInvoicePage]--选择类别失败--失败原因是->', str(e))
            self.driver.quit()
Пример #9
0
 def click_add_more_link(self):
     """
     :return: 点击继续添加
     """
     publicPage = PublicPage(self.driver)
     link_loc = self.driver.find_element_by_partial_link_text('继续添加')
     publicPage.click_elem(link_loc)
Пример #10
0
 def select_operation_item(self, item_index):
     if item_index == 0:
         operation_name = '结转'
     elif item_index == 1:
         operation_name = '过帐'
     elif item_index == 2:
         operation_name = '反过帐'
     elif item_index == 3:
         operation_name = '驳回审核'
     page_url = self.driver.current_url
     print('[AccountDashbaordPage]--page_url=>', page_url)
     if '/app/home-page/accounting' in page_url:
         try:
             publicPage = PublicPage(self.driver)
             item_loc = self.driver.find_element_by_css_selector(
                 btn_drop_item_elem).find_elements_by_tag_name(
                     btn_tag_name_elem)[item_index]
             publicPage.click_elem(btn_loc)
         except Exception as e:
             print(
                 '[AccountDashbaordPage]select_operation_item--' +
                 operation_name + ' 失败--失败原因=>', str(e))
     elif '/app/home-page/assist' in page_url:
         print('[AccountDashbaordPage]select_operation_item--' +
               operation_name + '失败')
     else:
         print('[AccountDashbaordPage]select_operation_item--' +
               operation_name + '失败!')
Пример #11
0
 def select_name(self, user_name):
     publicPage = PublicPage(self.driver)
     names = self.get_name_list()
     name_index = names.index(user_name)
     name_loc = self.driver.find_element_by_tag_name(
         'ul').find_elements_by_tag_name(
             'li')[name_index].find_element_by_xpath('div/a/div[2]')
     publicPage.click_elem(name_loc)
Пример #12
0
 def cancel(self):
     try:
         publicPage = PublicPage(self.driver)
         btn_loc = self.driver.find_element_by_xpath(cancel_btn_elem)
         publicPage.click_elem(btn_loc)
     except Exception as e:
         print('[AddStuffPage] There was an exception when cancel=>',
               str(e))
Пример #13
0
 def save(self):
     try:
         publicPage = PublicPage(self.driver)
         publicPage.scroll_to_bottom()
         btn_loc = self.driver.find_element_by_xpath(save_btn_elem)
         publicPage.click_elem(btn_loc)
     except Exception as e:
         print('[AddStuffPage] There was an exception when save=>', str(e))
Пример #14
0
 def click_record_invoice_btn(self):
     try:
         publicPage = PublicPage(self.driver)
         btn_loc = self.driver.find_element_by_xpath(
             list_base_elem + self.invoice_io + record_invoice_btn_elem)
         publicPage.click_elem(btn_loc)
     except Exception as e:
         print('[InvoiceListPage]click_record_invoice_btn--点击 记' +
               page_name + '按钮失败,失败原因是=', str(e))
Пример #15
0
 def click_fund_check(self):
     try:
         publicPage = PublicPage(self.driver)
         check_loc = self.driver.find_element_by_xpath(fund_check_elem)
         publicPage.click_elem(check_loc)
     except Exception as e:
         print(
             '[AddStuffPage] There was an exception when click_fund_check=>',
             str(e))
Пример #16
0
 def close_modal(self):
     try:
         publicPage = PublicPage(self.driver)
         btn_loc = self.driver.find_element_by_xpath(close_modal_btn_elem)
         publicPage.click_elem(btn_loc)
     except Exception as e:
         print('[PartnerSetPage]close_modal--关闭modal框失败 失败--失败原因是=>',
               str(e))
         exit()
Пример #17
0
 def click_add_btn(self):
     """
     :return: 点击保存按钮
     """
     try:
         publicPage = PublicPage(self.driver)
         click_loc = self.driver.find_element_by_id(add_btn_elem)
         publicPage.click_elem(click_loc)
     except Exception as e:
         print('[ContactPage]click_add_btn--点击添加按钮失败--失败原因是=>', str(e))
Пример #18
0
 def click_modify_password_link(self):
     """
     :return:点击修改密码链接
     """
     publicPage = PublicPage(self.driver)
     name = self.get_login_user_name()
     open_list_loc = self.driver.find_element_by_link_text(name)
     publicPage.click_elem(open_list_loc)
     link_loc = self.driver.find_element_by_link_text('修改密码')
     publicPage.click_elem(link_loc)
     time.sleep(2)
Пример #19
0
 def close_modal(self):
     """
     :return: 关闭添加往来窗口
     """
     try:
         publicPage = PublicPage(self.driver)
         click_loc = self.driver.find_element_by_xpath(close_btn_elem)
         publicPage.click_elem(click_loc)
     except Exception as e:
         print('[ContactPage] There was an exception when close_modal=>',
               str(e))
Пример #20
0
 def click_edit_btn(self, name):
     publicPage = PublicPage(self.driver)
     names_elem = '//*[@id="departmentName"]'
     name_locs = self.driver.find_element_by_xpath(names_elem)
     if name_locs.text == name:
         edit_elem = names_elem + '../following-sibling::td/button[@id="editDepartmentInfo"]'
         print('edit_elem=>', edit_elem)
         edit_loc = self.driver.find_element_by_xpath(edit_elem)
         publicPage.click_elem(edit_loc)
     else:
         print('列表中不存在名为' + name + '的股东')
         exit()
Пример #21
0
    def click_edit(self):
        """
		:return: 点击编辑事件
		"""
        try:
            publicPage = PublicPage(self.driver)
            edit_loc = self.driver.find_element_by_xpath(edit_xpath)
            publicPage.click_elem(edit_loc)
        except Exception as e:
            print(
                '[CompBillingPage] There was an exception when click_edit= %s',
                str(e))
Пример #22
0
    def click_btn(self, btn_name):
        """
		:param btn_name: 按钮名称,可选值(start,edit,import)
		:return: 点击 '启用帐套''编辑'、'导入'按钮
		"""
        publicPage = PublicPage(self.driver)
        if btn_name == 'start':
            btn_elem = start_btn_elem
        elif btn_name == 'edit':
            btn_elem = edit_btn_elem
        elif btn_name == 'import':
            btn_elem = import_btn_elem
        publicPage.click_elem(btn_elem)
Пример #23
0
 def click_add_btn(self):
     try:
         publicPage = PublicPage(self.driver)
         add_btn_loc = self.driver.find_element_by_xpath(add_btn_elem)
         publicPage.click_elem(add_btn_loc)
         input_loc = self.driver.find_element_by_xpath(partner_name_elem)
         if publicPage.is_element_present(input_loc):
             print('[PartnerSetPage]click_add_btn--点击添加按钮 成功!--')
         else:
             print('[PartnerSetPage]click_add_btn--点击添加按钮 失败!--')
             exit()
     except Exception as e:
         print('[PartnerSetPage]click_add_btn--点击添加按钮 失败--失败原因是=>', str(e))
         exit()
Пример #24
0
 def carry_forward_submit( self, btn_name ):
     """
     :param btn_name:可选值(查看科目余额表、知道了)
     :return:结转 确认
     """
     if btn_name == '查看科目余额表':
         btn_elem = account_balance_sheet_btn_elem
     elif btn_name == '知道了':
         btn_elem = carry_forward_ok_btn_elem
     else:
         print('[carry_forward_submit]btn_name输入错误,请重新输入')
     publicPage = PublicPage(self.driver)
     btn_loc = self.driver.find_element_by_xpath(btn_elem)
     publicPage.click_elem(btn_loc)
Пример #25
0
 def reject_submit( self, btn_name ):
     """
     :param btn_name:可选值(是、否)
     :return:确认 驳回审核、取消 驳回审核
     """
     if btn_name == '是':
         btn_elem = dismission_confirm_btn_elem
     elif btn_name == '否':
         btn_elem = dismission_confirm_btn_elem
     else:
         btn_elem = None
         print('[reject_submit]btn_name输入错误,请重新输入!')
     publicPage = PublicPage(self.driver)
     btn_loc = self.driver.find_element_by_xpath(btn_elem)
     publicPage.click_elem(btn_loc)
Пример #26
0
 def click_cancel_btn(self):
     try:
         if self.record_type == 'accountTransfers':
             btn_elem = transfer_cancel_btn_elem
         else:
             btn_elem = cancel_btn_elem
         public_page = PublicPage(self.driver)
         btn_loc = self.driver.find_element_by_xpath(page_base_xpath_elem +
                                                     self.record_name +
                                                     btn_elem)
         public_page.click_elem(btn_loc)
     except Exception as e:
         print(
             '[RevenueAndExpenditurePage] There was an exception when click_cancel_btn=>',
             str(e))
Пример #27
0
 def submit(self, btn_name):
     try:
         if btn_name == 'save':
             btn_elem = save_btn_elem
             btn_name = '保存按钮'
         else:
             btn_elem = cancel_btn_elem
             btn_name = '取消按钮'
         btn_loc = self.driver.find_element_by_xpath(btn_elem)
         publicPage = PublicPage(self.driver)
         publicPage.click_elem(btn_loc)
     except Exception as e:
         print('[PartnerSetPage]submit--点击' + btn_name + ' 失败--失败原因是=>',
               str(e))
         exit()
Пример #28
0
 def get_name_list(self):
     """
     :return: 返回已经邀请过的用户名
     """
     publicPage = PublicPage(self.driver)
     drop_loc = self.driver.find_element_by_xpath(name_drop_elem)
     publicPage.click_elem(drop_loc)
     names_loc = self.driver.find_element_by_tag_name(
         'ul').find_elements_by_tag_name('li')
     names = []
     for name_loc in names_loc:
         name = name_loc.find_element_by_xpath('div/a/div[2]').text
         names.append(name)
     print(names)
     return names
Пример #29
0
 def posting_submit( self, btn_name ):
     """
     :param btn_name:弹窗按钮名称,可选值(过帐、取消)
     :return:过帐 确认
     """
     if btn_name == '过帐':
         btn_elem = posting_confirm_elem
         name = '确认过帐'
     elif btn_name == '取消':
         btn_elem = posting_cancel_elem
         name = '取消过帐'
     else:
         btn_elem = None
         print('[posting_submit]btn_name输入错误,请重新输入')
     btn_loc = self.driver.find_element_by_xpath(btn_elem)
     publicPage = PublicPage(self.driver)
     print('[当前操作是:', name)
     publicPage.click_elem(btn_loc)
Пример #30
0
 def submit( self , btn_name ):
     """
     点击保存或取消按钮
     :param btn_name: 按钮名称,可选值(save,cancel)
     """
     if btn_name == 'save':
         btn_elem = save_btn_elem
         operation_name = '保存'
     elif btn_name == 'cancel':
         btn_elem = cancel_btn_elem
         operation_name = '取消'
     else:
         btn_elem = None
         print( '按钮名称输入错误,请检查输入值。' )
     print( '正在做' + operation_name + '修改的操作:' )
     publicPage = PublicPage( self.driver )
     btn_loc = self.driver.find_element_by_id( btn_elem )
     publicPage.click_elem( btn_loc )