如何杀死在后台运行的IEDriver exe进程(Selenium Webdriver)? [英] How to Kill IEDriver exe process running in background (Selenium webdriver)?
问题描述
我正在使用Selenium Webdriver(用于Internet Explorer).它所做的基本上是在Internet Explorer中打开一个网页并进行表单提交.
I'm using selenium webdriver(for Internet Explorer). What it does it basically opens a webpage in internet explorer and does form submitting.
如何自动杀死在后台运行的internetexplorer.exe?
How can I kill internetexplorer.exe running in background Automatically ?
推荐答案
您可以在测试脚本的末尾添加以下代码,以关闭IE驱动程序.因此,无需手动关闭它.
You can add the following code at the end of your test script to close the IE Driver. So there is no need of closing it manually.
try {
Runtime.getRuntime().exec("taskkill /F /IM IEDriverServer.exe");
} catch (IOException e) {
e.printStackTrace();
}
否则打开记事本并粘贴以下代码.
Else open notepad and paste the following code.
taskkill /F /IM IEDriverServer.exe
将文件另存为closedriver.bat
Save the file as closedriver.bat
当您要关闭IE驱动程序时,请单击此批处理文件.
Click on this batch file when u want to close the IE Driver.
这篇关于如何杀死在后台运行的IEDriver exe进程(Selenium Webdriver)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!