Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
 def get_input_error(self, input_name):
     public_page = PublicPage(self.driver)
     error_loc = self.driver.find_element_by_id(input_name + '-error')
     public_page.is_element_present(error_loc)
     error_msg = error_loc.text
     print('The text danger message is ', error_msg)
     return error_msg
Ejemplo n.º 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)
Ejemplo n.º 5
0
 def get_comp_name(self):
     """
     :return:获取当前帐套名称
     """
     publicPage = PublicPage(self.driver)
     text_loc = self.driver.find_element_by_xpath(comp_name_elem)
     return publicPage.get_value(text_loc)
Ejemplo n.º 6
0
 def get_account_company_name(self):
     """
     :return:代帐公司名称
     """
     publicPage = PublicPage(self.driver)
     name_loc = self.driver.find_element_by_xpath(account_company_name_elem)
     return publicPage.get_value(name_loc)
Ejemplo n.º 7
0
 def select_industry( self, industry ):
     """
     :param industry:行业性质
     """
     public_page = PublicPage(self.driver)
     drop_loc = self.driver.find_element_by_name(industry_drop_elem)
     public_page.select_dropdown_item(drop_loc, industry)
Ejemplo n.º 8
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 '无操作'
Ejemplo n.º 9
0
 def select_enable_date( self, begin_date ):
     """
     :param begin_date: 启用帐套日期,eg:一月、二月...
     """
     public_page = PublicPage(self.driver)
     drop_loc = self.driver.find_element_by_xpath(enable_date_drop_elem)
     public_page.select_month(drop_loc, begin_date)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
 def add_contact(self, contact_info):
     """
     :param contact_info: 添加往来信息数据
     contact_info[0]:名称
     contact_info[1]:性质
     contact_info[2]:联系人
     contact_info[3]:账户名称
     contact_info[4]:账号
     contact_info[5]:手机号
     """
     publicPage = PublicPage(self.driver)
     num = str(publicPage.random_num(1000000))
     self.click_add_btn()
     time.sleep(2)
     publicPage.switch_to_add_contact_modal_dialog()
     if contact_info[0] == '' or contact_info[0] == '其他' or contact_info[
             0] == '内部代表':
         self.set_name(contact_info[0])
     else:
         self.set_name(contact_info[0] + num)
     self.select_contact_property(contact_info[1])
     if contact_info[1] == '单位':
         self.set_contact(contact_info[2])
     self.set_account_name(contact_info[3])
     self.set_account_num(contact_info[4])
     self.set_phone_num(contact_info[5])
Ejemplo n.º 12
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))
Ejemplo n.º 13
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()
Ejemplo n.º 14
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 + '失败!')
Ejemplo n.º 15
0
 def get_phone_num( self ):
     """
     :return:获取当前用户的手机号
     """
     publicPage = PublicPage( self.driver )
     num_loc = self.driver.find_element_by_id( phone_elem )
     publicPage.get_value( num_loc )
Ejemplo n.º 16
0
 def get_login_user_name(self):
     """
     :return:登陆用户用户名称
     """
     publicPage = PublicPage(self.driver)
     name_loc = self.driver.find_element_by_xpath(login_user_name_elem)
     return publicPage.get_value(name_loc)
Ejemplo n.º 17
0
 def get_modal_body_text( self ):
     """
     :return:弹窗提示内容
     """
     publicPage = PublicPage(self.driver)
     text_loc = self.driver.find_element_by_xpath(modal_body_text_elem)
     publicPage.get_value(text_loc)
Ejemplo n.º 18
0
 def get_modal_title( self ):
     """
     :return:弹窗标题
     """
     publicPage = PublicPage(self.driver)
     title_loc = self.driver.find_element_by_css_selector(modal_title_elem)
     publicPage.get_value(title_loc)
Ejemplo n.º 19
0
    def setUpClass(self):
        self.driver = webdriver.Chrome()
        publicPage = PublicPage(self.driver)
        publicPage.max_window()
        self.driver.implicitly_wait(30)

        loginPage = LoginPage(CompInfo.BASE_URL, self.driver)
        loginPage.login(CompInfo.LOGIN_DATA)
Ejemplo n.º 20
0
 def set_confirm_password( self , confirm_password ):
     """
     设置确认密码
     :param confirm_password: 确认密码
     """
     publicPage = PublicPage( self.driver )
     input_loc = self.driver.find_element_by_name( confirm_password_elem )
     publicPage.set_value( input_loc , confirm_password )
Ejemplo n.º 21
0
 def set_new_password( self , new_password ):
     """
     设置新密码
     :param new_password: 新密码
     """
     publicPage = PublicPage( self.driver )
     input_loc = self.driver.find_element_by_name( new_password_elem )
     publicPage.set_value( input_loc , new_password )
Ejemplo n.º 22
0
 def set_old_password( self , old_password ):
     """
     输入原密码
     :param old_password: 原密码
     """
     publicPage = PublicPage( self.driver )
     input_loc = self.driver.find_element_by_name( old_password_elem )
     publicPage.set_value( input_loc , old_password )
Ejemplo n.º 23
0
 def select_property( self, account_property ):
     """
     选择帐套性质
     :param account_property: 可选值(一般纳税人、小规模纳税人)
     """
     public_page = PublicPage(self.driver)
     drop_loc = self.driver.find_element_by_name(property_elem)
     public_page.select_dropdown_item(drop_loc, account_property)
Ejemplo n.º 24
0
 def select_accounting_standard( self, accounting_standard ):
     """
     选择会计制度
     :param accounting_standard:可选值(2013小企业会计准则、村集体经济组织会计制度)
     """
     publicPage = PublicPage(self.driver)
     drop_loc = self.driver.find_element_by_name(accounting_standard_elem)
     publicPage.select_dropdown_item(drop_loc, accounting_standard)
Ejemplo n.º 25
0
 def set_name(self, name):
     """
     :param name: 姓名
     :return:输入姓名
     """
     publicPage = PublicPage(self.driver)
     input_loc = self.driver.find_element_by_xpath(name_input_elem)
     publicPage.set_value(input_loc, name)
Ejemplo n.º 26
0
 def set_phone(self, phone_num):
     """
     :param phone_num: 手机号
     :return:输入手机号
     """
     publicPage = PublicPage(self.driver)
     input_loc = self.driver.find_element_by_xpath(phone_input_elem)
     publicPage.set_value(input_loc, phone_num)
Ejemplo n.º 27
0
 def submission( self ):
     """
     :return:提交审核(计提)
     """
     topBarPage = TopBarPage(self.driver)
     publicPage = PublicPage(self.driver)
     topBarPage.click_operation_btn('提交审核(计提)')
     publicPage.wait_until_loader_disapeared()
Ejemplo n.º 28
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)
Ejemplo n.º 29
0
 def reverse_posting( self ):
     """
     :return:反过帐
     """
     publicPage = PublicPage(self.driver)
     topBarPage = TopBarPage(self.driver)
     topBarPage.click_operation_btn('反过帐')
     publicPage.wait_until_loader_disapeared()
Ejemplo n.º 30
0
 def set_position(self, position):
     try:
         publicPage = PublicPage(self.driver)
         input_loc = self.driver.find_element_by_xpath(position_elem)
         publicPage.set_value(input_loc, position)
     except Exception as e:
         print('[AddStuffPage] There was an exception when set_position=>',
               str(e))