我试图用PhantomJS
(v 2.0)在C#
中测试一些东西,但没有正确关闭它,这导致我的机器使用100%的CPU。phantomjs没有关闭进程
所有的程序工作正常,除了关闭它的部分。
我试着用
driver.Dispose();
driver.Quit();
driver.Close();
和(全部)
Enviroment.Exit(-1);
Enviroment.Exit(0);
Enviroment.Exit(1);
return;
,但在任务管理器的进程仍然
我试图关闭控制台惨遭
Process.GetCurrentProcess().Kill();
但是s直到不工作。
有消息说幻象显示我在控制台
[INFO - 2015-10-19T09:43:58.542Z] GhostDriver - Main - running on port 62810
[INFO - 2015-10-19T09:44:17.480Z] Session [f7138220-7645-11e5-b667-c72dd4c4644c
] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true
,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"loc
alToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW6
4) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.0.0 Safari/538.1","webSecur
ityEnabled":true}
[INFO - 2015-10-19T09:44:17.499Z] Session [f7138220-7645-11e5-b667-c72dd4c4644c
] - page.customHeaders: - {}
[INFO - 2015-10-19T09:44:17.507Z] Session [f7138220-7645-11e5-b667-c72dd4c4644c
] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.0.0
","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"windows-7-32bit
","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databas
eEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"
browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":f
alse,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"prox
yType":"direct"}}
[INFO - 2015-10-19T09:44:17.530Z] SessionManagerReqHand - _postNewSessionComman
d - New Session Created: f7138220-7645-11e5-b667-c72dd4c4644c
[INFO - 2015-10-19T09:45:27.620Z] ShutdownReqHand - _handle - About to shutdown
此外,我使用的硒,但我不认为有一个重要的信息。
有什么想法?
谢谢。
不幸的是,这似乎是一个常见问题。见[this](https://github.com/detro/ghostdriver/issues/162)和[this](http://stackoverflow.com/questions/25110624/how-to-properly-stop-phantomjs-execution) 。 –