当前位置:网站首页>One click batch termination of processes according to the process name (chromedriver.exe)
One click batch termination of processes according to the process name (chromedriver.exe)
2022-07-21 23:46:00 【embracestar】
Scenario introduction
In the use of python+selenium+chrome During automated testing , Every time an error occurs in the program, it terminates unexpectedly or forgets to add driver.quit() Will reside in the background of the computer chromedriver.exe process , In the long run, a bunch of processes will reside and occupy computer resources , It is very troublesome to end the process one by one .
stay Windows The system can use commands to end processes in batch with one click . It is worth mentioning that , The most standardized approach is to put the code that may cause errors in try In block , And cultivate the habit of adding driver.quit() The habit of .
Scheme 1
Open the computer as an administrator cmd, Enter the following command to end the process ,/F Means to force the end of a process ,/IM Means to end the process according to the process name .
TASKKILL /F /IM chromedriver.exe
Option two
Create a text file , You can call it “ Batch end chromedriver process .txt”, Enter the above instructions , Finally, change the suffix to bat, Run the batch program as an administrator .( Here you enter pause Command to prevent the exit of the window )
Option three
Create a py file , You can call it “ Batch end chromedriver process .py”, Enter the following code in it , Directly in python Run in cmd Instructions .
import os
if __name__ == '__main__':
command = 'TASKKILL /F /IM chromedriver.exe'
os.system(command)
The output garbled code is due to Pycharm Output code and cmd Different output codes of , It is suggested to ignore this problem directly , Do not modify the default output encoding format .
边栏推荐
- postman接口测试和压力测试
- JMeter之WebService(soap)请求
- Leetcode notes 88 Merge two ordered arrays
- postman“在Tests中通过data.token获取token失败”的解决方法
- LVM磁盘多分区扩容(fdisk,vgdata,lvdata,df,resize2fs,lvextend,partprobe)
- Test case exercise 2 - vendor account information
- sysstat安装并升级到11.5.5版本
- [tips] quickly pop up the CMD window under the current directory and the path is the current path
- JMeter read response header information / get request header
- Day02 测试用例知识点总结(上)
猜你喜欢
Variable usage method of BeanShell of JMeter
JMeter read response header information / get request header
Postman interface test and pressure test
How to write the use case of APP login function?
JMeter saves test process data in page form
LVM disk multi partition expansion (fdisk, vgdata, lvdata, DF, resize2fs, lvextend, partprobe)
Use case exercise 1
How to write the use case of APP registration function?
Scene method practice
How can app testing ensure multi model coverage?
随机推荐
The solution of "the client page cannot be loaded" after running CS project with idea
连接以前可用的MySQL数据库报10061 unknown error 错误
Leetcode notes 1 Sum of two numbers
Test triangulation, and use direct linear transformation method to calculate 3D point coordinates (3D reconstruction task2-1)
【软件测试模型进化】
English abbreviation of team members
Day02 测试用例知识点总结(上)
2021-06-22
测试用例练习2-厂商账户信息
JMeter script generation is based on RAP2
Common functions of Charles
【项目验收】记最近一次项目验收之用户关注点
How to do regression test
动态规划求解(添+号求最小值和问题)
postman“在Tests中通过data.token获取token失败”的解决方法
快速解决电脑无线网络无法连接问题
Learning from Chapter 1 to Chapter 5 of electrical EPLAN software
How to do app upgrade test?
Study of Chapter 6 to Chapter 10 of electrical EPLAN software
Nine super practical conclusions that must be remembered in the use of linked lists