相关疑难解决方法(0)

Python/Selenium/Firefox:无法使用指定的配置文件路径启动firefox

我尝试使用指定的配置文件启动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()
Run Code Online (Sandbox Code Playgroud)

/Users/p2mbot/projects/test/firefox_profile - 这个目录是正确的firefox配置文件目录,我创建它 firefox-bin --ProfileManager

但是当我通过selenium检查firefox中的缓存页面时,它有不同的缓存路径:

Storage disk location:  /var/folders/jj/rdpd1ww53n95y5vx8w618k3h0000gq/T/tmpp2ahq70_/webdriver-py-profilecopy/cache2
Run Code Online (Sandbox Code Playgroud)

如果通过firefox-bin --ProfileManager运行firefox并选择配置文件,它将显示在about:cache page的正确路径 /Users/p2mbot/projects/test/firefox_profile

为什么webdriver忽略firefox的配置文件路径?使用chrome没有这样的问题.

python firefox selenium

2
推荐指数
1
解决办法
3245
查看次数

标签 统计

firefox ×1

python ×1

selenium ×1