예제 #1
0
 def click_element(self,section,option):
     '''
     点击元素
     :param section:localElement.ini文件中的一级标签
     :param option:二级标签
     :return:
     '''
     by,value = self.getElementInfo(section,option)
     self.findElement(by,value).click()
     do_logger.info('点击元素正常 : %s : %s'%(section,option))
예제 #2
0
 def get_text(self,section,option):
     '''
     获取元素中的文本
     :param section: localElement.ini文件中的一级标签
     :param option: 二级标签
     :return:
     '''
     by,value = self.getElementInfo(section,option)
     message = self.findElement(by,value).text
     do_logger.info('获取文本正常 : %s : %s : %s'%(section,option,message))
     return message
예제 #3
0
 def get_successMsg(self):
     '''
     获取错误提示信息
     :return:
     '''
     try:
         time.sleep(1)
         msg = self.driver.find_element_by_xpath('/html/body/div[2]/div/div[1]/p').text
         do_logger.info('获取提示信息成功 : %s' %msg)
         return msg
     except:
         do_logger.error('无法获取提示信息')
예제 #4
0
 def clear_dir(self, path):
     '''
     清空文件夹
     :param path: 需要被清空的文件夹
     :return:
     '''
     filelist = os.listdir(path)  #获取文件夹下的所有文件
     for file in filelist:
         fullfile = os.path.join(path, file)
         if os.path.isfile(fullfile):
             os.remove(fullfile)
         elif os.path.isdir(fullfile):
             shutil.rmtree(fullfile)
     do_logger.info('已清空文件夹%s' % path)
예제 #5
0
    def input_text(self,section,option,text,clear=True):
        '''
        输入文本
        :param section:localElement.ini文件中的一级标签
        :param option:二级标签
        :return:
        '''

        by,value = self.getElementInfo(section,option)
        if clear:
            self.findElement(by,value).clear()
            self.findElement(by,value).send_keys(text)
        else:
            self.findElement(by, value).send_keys(text)
        do_logger.info('输入文本正常 : %s : %s : %s'%(section,option,text))
예제 #6
0
 def teardown_class(self):
     self.driver.close()
     do_logger.info('新建分期测试用例执行结束')
예제 #7
0
 def setup_class(self):
     do_logger.info('开始执行新建分期测试用例')
     self.driver = BrowserEngine().init_browser()  #打开浏览器
     LoginPage(self.driver).cookie_login()  #登录
     self.index = IndexPage(self.driver)
     self.resource = ResourcePage(self.driver)
예제 #8
0
 def teardown_class(self):
     do_logger.info('登录页面测试用例执行结束')
     loggingComdat().close_log()
예제 #9
0
    def setup_class(self):

        do_logger.info('开始执行登录页面测试用例')
예제 #10
0
def login():
    do_logger.info('执行登录步骤')
    driver = BrowserEngine().init_browser()
    LoginPage(driver).cookie_login()