[英]Selenium python web driver doesnt close
我在測試拆卸時調用driver.quit()
,但是chromedriver進程保持活動狀態並且不會關閉。 因此,執行之間有時Chrome根本不會打開,我需要手動關閉進程。 有人熟悉這個問題嗎?
我正在使用硒3.5
將您的代碼更改為以下,以確保退出后該過程不存在
import signal
import os
pid = driver.service.process.pid
driver.quit()
try:
os.kill(int(pid), signal.SIGTERM)
print("Killed chrome using process")
except ProcessLookupError as ex:
pass
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.