Search code examples
pythonseleniumfirefoxdebianheadless

Using Selenium with headless mode on Debian server


I am trying to run a python script using selenium in headless mode.

However, I get this error:

"selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process"

The same code works well on a normal linux version (not a server one)


Solution

  • I found the solution.

    The problem was due to the wrong installation of firefox on my debian server.

    After adding the good repository deb http://ftp.fr.debian.org/debian sid main I was able to install firefox-esr and its dependencies via a simple apt install command.

    Once all was installed, the python script worked as expected !

    The new problem for me is now to configure www-data user permissions in order to allow it to execute the python script which needs write and execute permissions. (Currently encountering

    IOError: [Errno 13] Permission denied: 'geckodriver.log'

    )

    I am looking for a descent solution: allowing its execution as root without password seems too dangerous in terms of security for me..