Example #1
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
 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()
Example #3
0
 def go_to_partnerset_page(self):
     try:
         publicPage = PublicPage(self.driver)
         self.driver.get(self.base_url + partner_set_url)
         time.sleep(3)
         add_loc = self.driver.find_element_by_xpath(add_btn_elem)
         if publicPage.is_element_present(add_loc):
             print('[SettingPage]++++++ 去股东页面 成功++++++')
         else:
             print('[SettingPage]------ 去股东页面 失败!------')
     except Exception as e:
         print(
             '[SettingPage] There was an exception when go_to_partnerset_page= %s', str(e))
Example #4
0
 def go_to_tax_rate_page(self):
     try:
         publicPage = PublicPage(self.driver)
         self.driver.get(self.base_url + tax_rate_url)
         time.sleep(3)
         tax_loc = self.driver.find_element_by_xpath(tax_rate_url)
         if publicPage.is_element_present(tax_loc):
             print('[SettingPage]++++++ 去税率设置页面 成功++++++')
         else:
             print('[SettingPage]------ 去税率设置页面 失败!------')
     except Exception as e:
         print(
             '[SettingPage] There was an exception when go_to_tax_rete_page= %s', str(e))
Example #5
0
 def go_to_mutil_user_page(self):
     try:
         publicPage = PublicPage(self.driver)
         self.driver.get(self.base_url + mutil_user_url)
         time.sleep(3)
         start_loc = self.driver.find_element_by_xpath(multi_user_xpath)
         if publicPage.is_element_present(start_loc):
             print('[SettingPage]++++++ 去用户管理页面 成功++++++')
         else:
             print('[SettingPage]------ 去用户管理页面 失败!------')
     except Exception as e:
         print(
             '[SettingPage] There was an exception when go_to_mutil_user_page= %s', str(e))
Example #6
0
 def go_to_setting_page(self):
     try:
         publicPage = PublicPage(self.driver)
         self.driver.get(self.base_url + comp_billing_url)
         time.sleep(3)
         comp_billing_loc = self.driver.find_element_by_xpath(
             comp_billing_xpath)
         if publicPage.is_element_present(comp_billing_loc):
             print('[SettingPage]++++++ 去帐套信息页面 成功++++++')
         else:
             print('[SettingPage]------ 去帐套信息页面 失败!------')
     except Exception as e:
         print(
             '[SettingPage] There was an exception when go_to_setting_page= %s', str(e))
Example #7
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()
Example #8
0
    def test_contact_input_show(self):
        """4.往来信息-测试性质为单位时-联系人输入框 显示"""
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        page = ContactPage(self.driver)
        publicPage = PublicPage(self.driver)
        readExcel = ReadExcel(self.add_contact_data_dir)

        settingPage.go_to_contact_page()
        add_contact_data = readExcel.get_value_by_row(0, 3)
        page.add_contact(add_contact_data)
        page.submit('save')

        contact_loc = self.driver.find_element_by_id(contact_elem)
        result = publicPage.is_element_present(contact_loc)
        self.assertEqual(result, 1)
        print('result=>', result)
Example #9
0
 def tearDown(self):
     page = CompBillingPage(self.driver)
     publicPage = PublicPage(self.driver)
     publicPage.scroll_to_top()
     if publicPage.is_element_present(
             self.driver.find_element_by_xpath(edit_xpath)):
         page.click_edit()
         page.set_comp_name(CompInfo.COMP_NAME)
         page.save()
         end_name = page.get_comp_name()
         if end_name == CompInfo.COMP_NAME:
             print('end_name = ', end_name, '\n公司名重置成功!')
         else:
             print('end_name = ', end_name, '\n公司名重置失败!')
     else:
         print('编辑按钮不可见!!!!!')
     self.driver.quit()
Example #10
0
 def has_danger_is_show(self):
     publicPage = PublicPage(self.driver)
     ui_loc = self.driver.find_element_by_css_selector(has_danger_elem)
     print('publicPage.is_element_present(ui_loc)=>',
           publicPage.is_element_present(ui_loc))
     return publicPage.is_element_present(ui_loc)
Example #11
0
 def upload_file(self):
     publicPage = PublicPage(self.driver)
     upload_btn_loc = self.driver.find_element_by_id('fileUploadBtn')
     publicPage.is_element_present(upload_btn_loc)
     upload_btn_loc.send_keys(self.file_dir)