我尝试使用指定的配置文件启动Firefox:
firefox_profile = webdriver.FirefoxProfile('/Users/p2mbot/projects/test/firefox_profile')
driver = webdriver.Firefox(firefox_profile=firefox_profile)
driver.get('http://google.com')
time.sleep(60)
driver.quit()
/Users/p2mbot/projects/test/firefox_profile
- 这个目录是正确的Firefox配置文件目录,我使用firefox-bin --ProfileManager
创建了它。
但是当我通过Selenium检查Firefox的about:cache页面时,它具有不同的缓存路径:
Storage disk location: /var/folders/jj/rdpd1ww53n95y5vx8w618k3h0000gq/T/tmpp2ahq70_/webdriver-py-profilecopy/cache2
如果通过firefox-bin --ProfileManager运行火狐并选择配置文件,则在about:cache页面上会显示正确的路径:/Users/p2mbot/projects/test/firefox_profile 为什么Webdriver会忽略火狐的配置文件路径?使用Chrome就没有这样的问题。