selenium高级应用 - 结束Windows中浏览器的进程

结束Windows中浏览器的进程

#-*- coding:utf-8
#结束Windows中浏览器的进程
from selenium import webdriver
import unittest

class TestDemo(unittest.TestCase):

    def test_killWindowsProcess(self):
        #启动浏览器
        firefoxDiver = webdriver.Firefox(executable_path="C:\webdriver_firefox_driver")
        import os
        #结束Firefox进程
        returnCode = os.system("taskfill/F/iM firefox.exe")
        if returnCode == 0:
            print "成功结束Firefox进程"
        else:
            print u"结束进程失败"

if __name__ == "__main__":
    unittest.main()

  

猜你喜欢

转载自www.cnblogs.com/aszeno/p/10340009.html
今日推荐