Windows10 操作系统
appium1.8.0
python2.7
下面是代码:

#coding:utf-8
import PO.DRIVER
import unittest
import os
from selenium import webdriver
import time
import HTMLTestRunner

class Login(unittest.TestCase):
    def test_login(self):
        driver = PO.DRIVER.AppiumTest()
        driver.get_id("com.eisoo.anyshare:id/et_password").send_keys(123321)
        driver.get_id("com.eisoo.anyshare:id/tv_login").click()
        time.sleep(5)

if __name__ == '__main__':
    suite = unittest.TestSuite()
    suite.addTest(Login('test_login'))
    # unittest.TextTestRunner(verbosity=2).run(suite)
    timestr = time.strftime('%Y-%m-%d %X', time.localtime(time.time()))
    filename ='D:\\untitled1\\untitled\\appium\\result'+ timestr + '.html'
    fb = file(filename, 'wb')
    runner = HTMLTestRunner.HTMLTestRunner(stream=fb, title='eisooapptestreport', description='eisooapp')
    runner.run(suite)
    fb.close()

运行报错:
Traceback (most recent call last):
File "D:/untitled1/untitled/appium/Test_Case/Test_Login.py", line 22, in
fb = file(filename, 'wb')
IOError: [Errno 22] invalid mode ('wb') or filename: 'D:\untitled1\untitled\appium\result2018-06-05 15:13:05.html'

求助,这是什么原因呢???


↙↙↙阅读原文可查看相关链接,并与作者交流