使用quit
方法,而不是使用close
方法 ,如下代码
try:
wait = WebDriverWait(browser, 10)
except Exception as ex:
print(ex)
finally:
browser.quit()
原因参考源码:
quit
方法会关掉开启的chromedriver.exe
而close
是只是关闭当前窗口
使用quit
方法,而不是使用close
方法 ,如下代码
try:
wait = WebDriverWait(browser, 10)
except Exception as ex:
print(ex)
finally:
browser.quit()
原因参考源码:
quit
方法会关掉开启的chromedriver.exe
而close
是只是关闭当前窗口