Search code examples
python-3.xseleniumgeckodriverselenium-firefoxdriver

python - selenium firefox portable headless fails


Trying to get Firefox Portable v46 to function in headless mode. (only portable version that works)

Chrome portable can do this but I would like to know if firefox portable can.

I must include capabilities_argument["marionette"] = False otherwise an exception is thrown:

selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

In normal Firefox (not portable + recent version) ... disabling marionette also causes ops.add_argument("--headless") to fail ... this is why I believe disabling marionette is the issue.

os.environ['MOZ_HEADLESS'] = '1' ... Does not work either.

browser.set_window_position(-3000, 0) ... works, but only after being visible

I am also running multiple instances of firefox, hiding from task manager might not be an option.

Is there a way I can import marionette or get it to work somehow?


Solution

  • I have discovered that (in windows), once Firefox (most recent gecko-driver compatible version) is installed, the folder in which firefox.exe is kept, is portable.

    The folder can be transferred to any windows machine even if it has never had Firefox installed. And the folder containing Firefox.exe will run Firefox successfully

    This is the same with Chrome