Esempio n. 1
0
def login():
    log.logging(msg='Initialize', level="INFO")
    driver_path = read_ini(file_path='/data.ini').read_elements_data(
        node="driver", key="path")
    driver = webdriver.Chrome(driver_path)
    driver.maximize_window()
    driver.get("https://mail.qq.com/")
    screenshot().save_rt_screenshot(driver=driver, file_name='打开qq邮箱登陆页.png')
    log_in = loginBusiness(driver)
    log_in.login_in()
    yield driver
    log.logging(msg='End of test! TearDown!', level='INFO')
    time.sleep(3)
    driver.close()
Esempio n. 2
0
 def setup_class(self):
     log.logging(msg='Initialize', level="INFO")
     self._case_name = " {}case:{}{}".format('<',
                                             Testlogin.test_login.__name__,
                                             '>')
     try:
         driver_path = read_ini(file_path='/data.ini').read_elements_data(
             node="driver", key="path")
         self.driver = webdriver.Chrome(driver_path)
         self.driver.maximize_window()
         self.driver.get("https://mail.qq.com/")
         screenshot().save_rt_screenshot(driver=self.driver,
                                         file_name='打开qq邮箱登陆页.png')
     except:
         log.logging(msg=traceback.format_exc(), level='ERROR')
 def login_in(self):
     try:
         self.handler = loginHandler
         log_in = self.handler(driver=self.driver)
         case_name = '{}case:{}{}'.format(' <',
                                          sys._getframe(1).f_code.co_name,
                                          '>')
         log.logging(msg='input username' + case_name, level='INFO')
         log_in.send_username(self._username)
         log.logging(msg='input password' + case_name, level='INFO')
         log_in.send_pwd(self._pwd)
         screenshot().save_rt_screenshot(driver=self.driver,
                                         file_name='输入用户名密码.png')
         log.logging(msg='click login button' + case_name, level='INFO')
         log_in.click_login_btn()
         sleep(1)
         screenshot().save_rt_screenshot(driver=self.driver,
                                         file_name='点击登陆进入滑动验证页面.png')
         result = log_in.slide_verify_btn()
         screenshot().save_rt_screenshot(driver=self.driver,
                                         file_name='登陆成功.png')
         return result
     except:
         log.logging(msg=traceback.format_exc(), level="ERROR")
         return result
Esempio n. 4
0
 def qc_empyt_all_deleted_mail(self, comfirm_flag, onebyone_flag=False):
     try:
         case_name = '{}case:{}{}'.format(' <', sys._getframe(1).f_code.co_name, '>')
         if not isinstance(comfirm_flag, bool):
             raise Exception("comfirm参数必须是bool值")
         log.logging(msg='click deleted button'+case_name)
         sleep(1)
         self.main_op.click_deleted()
         sleep(1)
         screenshot().save_rt_screenshot(driver=self.driver, file_name='点击已删除进入已删除邮箱列表页.png')
         if onebyone_flag:
             log.logging(msg='choose mail one by one'+case_name)
             self.main_op.choose_mail_onebyone()
         else:
             log.logging(msg='click choose all button'+case_name)
             self.main_op.quick_choose_all_mail()
         screenshot().save_rt_screenshot(driver=self.driver, file_name='选中所有邮件.png')
         sleep(1)
         log.logging(msg='click quick delete button'+case_name)
         self.main_op.click_quick_delete_btn()
         sleep(2)
         screenshot().save_rt_screenshot(driver=self.driver, file_name='点击删除按钮.png')
         if comfirm_flag:
             log.logging(msg='click comfirm button'+case_name)
             self.main_op.click_comfirm_btn()
             screenshot().save_rt_screenshot(driver=self.driver, file_name='确认删除.png')
         else:
             log.logging(msg='click cancel button'+case_name)
             self.main_op.click_cancel_btn()
             screenshot().save_rt_screenshot(driver=self.driver, file_name='取消删除.png')
         sleep(2)
         screenshot().save_rt_screenshot(driver=self.driver, file_name='回到主页.png')
         mail_num = self.main_op.get_mail_count()
         return mail_num
     except:
         log.logging(msg=traceback.format_exc(), level='ERROR')
         return False
            log_in.send_username(self._username)
            log.logging(msg='input password' + case_name, level='INFO')
            log_in.send_pwd(self._pwd)
            screenshot().save_rt_screenshot(driver=self.driver,
                                            file_name='输入用户名密码.png')
            log.logging(msg='click login button' + case_name, level='INFO')
            log_in.click_login_btn()
            sleep(1)
            screenshot().save_rt_screenshot(driver=self.driver,
                                            file_name='点击登陆进入滑动验证页面.png')
            result = log_in.slide_verify_btn()
            screenshot().save_rt_screenshot(driver=self.driver,
                                            file_name='登陆成功.png')
            return result
        except:
            log.logging(msg=traceback.format_exc(), level="ERROR")
            return result


if __name__ == '__main__':
    driver_path = read_ini(file_path='/data.ini').read_elements_data(
        node="driver", key="path")
    driver = webdriver.Chrome(executable_path=driver_path)
    driver.maximize_window()
    driver.get("https://mail.qq.com/")
    screenshot().save_rt_screenshot(driver=driver, file_name='打开qq邮箱登陆页.png')
    log_in = loginBusiness(driver)
    main_opera = mainBusiness(driver)
    log_in.login_in()
    main_opera.qc_empyt_all_deleted_mail(comfirm_flag=False,
                                         onebyone_flag=True)