simulated_browser = webdriver.Chrome() simulated_browser.get("www.baidu.com") simulated_browser.close() simulated_browser.quit()

看如上这段代码,在打开selenium之后,一定要调用 close() 和 quit() 两个方法才能完全关闭你打开的Chrome浏览器,就算是设置了无头模式的浏览器也是一样

其中close是关闭chromium

而quit则是关闭chromedriver的

关注,分享使用python开发过程中碰到的各种难题,给你最佳时间的建议!人生苦短,我用python!