python - selenium firefox portable headless 失败
python - selenium firefox portable headless fails
正在尝试让 Firefox Portable v46 在 headless 模式下运行。 (只有便携式版本有效)
Chrome portable 可以做到这一点,但我想知道 firefox portable 是否可以。
我必须包含 capabilities_argument["marionette"] = False
否则会抛出异常:
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
在普通 Firefox 中(不可移植 + 最新版本)...禁用 marionette
也会导致 ops.add_argument("--headless")
失败...这就是为什么我认为禁用 marionette 是问题所在.
os.environ['MOZ_HEADLESS'] = '1'
... 也不行。
browser.set_window_position(-3000, 0)
... 有效,但只有在可见后才有效
我也是 运行 Firefox 的多个实例,从任务管理器中隐藏可能不是一个选项。
有什么方法可以 import marionette
或让它以某种方式工作吗?
我发现(在 windows 中),一旦安装了 Firefox(最新的 gecko 驱动程序兼容版本),保存 firefox.exe 的文件夹是可移植的。
该文件夹可以传输到任何 windows 机器,即使它从未安装过 Firefox。并且包含 Firefox.exe 的文件夹将 运行 Firefox 成功
这与Chrome相同
正在尝试让 Firefox Portable v46 在 headless 模式下运行。 (只有便携式版本有效)
Chrome portable 可以做到这一点,但我想知道 firefox portable 是否可以。
我必须包含 capabilities_argument["marionette"] = False
否则会抛出异常:
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
在普通 Firefox 中(不可移植 + 最新版本)...禁用 marionette
也会导致 ops.add_argument("--headless")
失败...这就是为什么我认为禁用 marionette 是问题所在.
os.environ['MOZ_HEADLESS'] = '1'
... 也不行。
browser.set_window_position(-3000, 0)
... 有效,但只有在可见后才有效
我也是 运行 Firefox 的多个实例,从任务管理器中隐藏可能不是一个选项。
有什么方法可以 import marionette
或让它以某种方式工作吗?
我发现(在 windows 中),一旦安装了 Firefox(最新的 gecko 驱动程序兼容版本),保存 firefox.exe 的文件夹是可移植的。
该文件夹可以传输到任何 windows 机器,即使它从未安装过 Firefox。并且包含 Firefox.exe 的文件夹将 运行 Firefox 成功
这与Chrome相同