python+selenium自动化脚本跑完后提示TextIOWrapper信息

自动化脚本跑完后,提示:.<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'> 

Time Elapsed: 0:00:10.638064

脚本能运行,并且报告也生成了。

就是有这个提示。


调用脚本:

#-*- coding: utf-8 -*-
import HTMLTestRunner
import unittest

from test_B.case_001 import Test


def suite():
   onetest = unittest.TestSuite()
   onetest.addTest(Test("login_test"))
   return onetest


if __name__ == '__main__':
   filename = "D:\\Pycharm\\result\\report0.html"
   fp = open(filename,"wb")
   runner =HTMLTestRunner.HTMLTestRunner(stream=fp,title=u'Report_title',description=u'Report_description')
   runner.run(suite())
   fp.close()



用例:

# -*- coding: utf-8 -*-

from selenium import webdriver
from time import sleep
import unittest


class Test(unittest.TestCase):
   def setUp(self):
      self.driver = webdriver.Firefox()
      self.driver.implicitly_wait(5)
      self.driver.get('http://10.2.29.216:8080/kmhc-image-report-web/#/login')
   def login_test(self):
      self.driver.find_element_by_id('name-txt').send_keys('longtest3')
      self.driver.find_element_by_id('pass-txt').send_keys('123456')
      self.driver.find_element_by_xpath('/html/body/div/div/div[2]/div/div/form/div[2]/div[4]/div').click()
   def tearDown(self):
      # sleep(2)
      sleep(3)
      self.driver.close()
      pass



相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页