我正在使用Selenium 3.5 for Python来测试我的Web应用程序的某些行为,使用本地页面和在线页面。 到目前为止,我只是使用Chrome作为主浏览器进行测试,一切正常。然后,我决定使用geckodriver v0.19.0使用Firefox 55.0.3。 我有以下问题:
file:///PATH/index.html
等本地网页,但即使使用quit()
函数也不会关闭浏览器; 这是我在Firefox中使用selenium的代码片段。
from selenium import webdriver
url = 'http://www.yahoo.com'
#url = 'file:///PATH/index.html'
browser = webdriver.Firefox()
browser.get(url)
browser.quit()
# borser.close() -> I also tried with the close()
我还读了this question第一个问题,但它不适用于当前使用的框架版本。 关于第二种,我只能为隐身模式找到部分解决方案,例如this one,但它无法按预期工作。
有什么想法吗?这是geckodriver中的一种bug吗?