我試圖用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) 。 –