如何在窗户上使用硒/python设置便携式Firefox



我已经尝试过此Python脚本在Windows上的Portable Firefox中打开一个URL,但是我得到SessionNotCreatedException Trackback。

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('path\to\FirefoxPortable32.exe')
exec_path = "path\to\geckodriver32.exe"
browser = webdriver.Firefox(executable_path=exec_path, firefox_binary=binary)
browser.get('some_url')

这是追溯:

文件" tst.py",第20行,in 浏览器= webdriver.firefox(executable_path = exec_path,firefox_binary = binary(文件" c: program文件 (x86( python37-32 lib site-packages selenium webdriver firefox webdriver.py", 第174行,在 init 中 keep_alive = true(文件" c: program文件(x86( python37-32 lib lib site-packages selenium selenium webdriver remote remote webdriver.py", 第157行,在 init 中 self.start_session(功能,browser_profile(文件" c: program文件 (x86( python37-32 lib site-packages selenium webdriver webdriver remote webdriver.py", 第252行,在start_session中 响应= self.execute(command.new_session,参数(文件" c: program文件 (x86( python37-32 lib site-packages selenium webdriver webdriver remote webdriver.py", 第321行,执行 self.error_handler.check_response(响应(文件" c: program文件 (x86( python37-32 lib site-packages selenium webdriver webdriver remote ermorhandler.py", 第242行,在check_response中 提高异常_class(消息,屏幕,stacktrace( selenium.common.exceptions.sessionnotcreatedException:消息:无法 要找到一组匹配的功能

我正在使用:

windows 7 (64 bit)
python 3.7
selenium 3.141
geckdriver v0.24.0 (64 bit)
FirefoxPortable 68.0.1 (64 bit)

任何想法如何使便携式Firefox工作?

将Firefox二进制的路径更改为" App"文件夹中的firefox.exe文件。例如。'path\to\FirefoxPortable\App\Firefox\firefox.exe'

最新更新