arsenic icon indicating copy to clipboard operation
arsenic copied to clipboard

Starting up Headless Firefox launches the GUI

Open Eternity71529 opened this issue 7 years ago • 1 comments

Hi I recently started using Arsenic because it's asynchronous. So far I got the hang of the normal WebDrivers so I started with using a headless one. I made a Firefox session which had the argument which causes a browser to go headless written on it, When the script loads up, it shows that the argument has indeed been passed but the Firefox Browser GUI loads up, is there any fix to this or this is a local issue? Here is my code:

import asyncio
import sys

from arsenic import get_session, keys, browsers, services

if sys.platform.startswith('win'):
    GECKODRIVER = './geckodriver.exe'
else:
    GECKODRIVER = './geckodriver'


async def hello_world():
    service = services.Geckodriver()
    browser = browsers.Firefox(firefoxOptions={'args': ['-headless']})
    async with get_session(service, browser) as session:
        ....
def main():
    loop = asyncio.get_event_loop()
    loop.run_until_complete(hello_world())


if __name__ == '__main__':
    print("Starting!")
    main()

Eternity71529 avatar Dec 27 '18 19:12 Eternity71529

That works for me:

browser = browsers.Firefox(**{'moz:firefoxOptions': {'args': ['-headless']}})

nokados avatar Jan 10 '19 19:01 nokados