结束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()

  

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2021-06-03
  • 2021-07-30
  • 2022-12-23
  • 2021-04-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2021-10-11
  • 2021-11-03
  • 2022-12-23
相关资源
相似解决方案