Exemplo n.º 1
0
 def __init__(self, ):
     browser = readConfig('config.ini', 'browser', 'browser')
     self.driver = init_env().open_browser(browser)
     # self.basePageAction = BasePage(driver)
     # 每步执行结果
     self.stepResult = {}
     # 测试集合执行结果
     self.caseResult = {}
Exemplo n.º 2
0
 def setUpClass(cls):
     _mylogger.info('打开应用')
     cls.driver = init_env().launch_app()
     cls.basicAct = BasePage(cls.driver)
     # 如果有升级弹窗,关闭
     try:
         _mylogger.info('检测是否有升级弹窗')
         cls.basicAct.click('id=>gxq_dialog_btn_left')
     except:
         _mylogger.warning('无升级弹窗,继续')
Exemplo n.º 3
0
 def setUpClass(cls):
     _mylogger.info('安装,启动应用中')
     cls.driver = init_env().install_launch_app()
     cls.basicAct = BasePage(cls.driver)
     # 如果有红包引导页,点击我已注册
     cls.basicAct.click('id=>gxq_has_reg_ed')
     try:
         cls.basicAct.click('id=>gxq_new_user_close')
     except:
         _mylogger.warning('无需二次关闭,继续')
Exemplo n.º 4
0
            try:
                el.click()
                selector = Select(el)
                selector.select_by_value(text)
                _mylogger.info('从下拉框中选择{}'.format(text))
            except Exception as e:
                _mylogger.error('发生异常{}'.format(e))
                self.get_window_img()

    # 或者网页标题
    def get_page_title(self, selector=None, text=None):
        _mylogger.info("Current page title is %s" % self.driver.title)
        return self.driver.title

    @staticmethod
    def sleep(seconds):
        time.sleep(seconds)
        _mylogger.info("Sleep for %d seconds" % seconds)


if __name__ == '__main__':
    driver = init_env().open_browser('Chrome')
    homepage = BasePage(driver)
    homepage.get('http://www.baidu.com')
    homepage.sleep(1)
    homepage.input('id=>kw', 'python')
    homepage.sleep(1)
    homepage.click('xpath=>//*[@id="su"]')
    homepage.sleep(1)
    homepage.quit_browser()