目前先用这个记录自动化测试相关内容,后期再进行整理:
1、自动化测试:testcase-->test suite ---> TestRunner
2、TestRunner时,一种将内容打印到html报告中,在控制台没有print内容,一种是打印到控制台上,建议写case时,用打印到控制台的,方便及时查看,写完case后,连起来运行用打印到html报告中的方式。
#将测试结果输出到测试报告中显示
runner = HTMLTestRunner(f, verbosity=2, title='接口自动化测试报告', description='接口html报告')
runner.run(suit)
#这个方法是将测试结果显示到控制台的
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suit)
3、页面嵌套iframe时,无法定位iframe中的元素:
参见地址:https://blog.csdn.net/wujialaoer/article/details/85159687?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
问题:

解决方法:
#定位到中间用户展示页面iframe iframe = self.driver.find_element_by_xpath('//div[@id="iframe_box"]/div/iframe') self.driver.switch_to.frame(iframe)
#定位添加按钮,点击按钮 userA = self.driver.find_element_by_xpath('//ul[@id="planTypeTwo"]/span[3]') time.sleep(3) userA.click() time.sleep(2)
                    
                
                
            
        
浙公网安备 33010602011771号