Why doesn’t input.send_keys() work in my Selenium WebDriver Python script when run as www-data? Why doesn’t input.send_keys() work in my Selenium WebDriver Python script when run as www-data? selenium selenium

Why doesn’t input.send_keys() work in my Selenium WebDriver Python script when run as www-data?


Maybe you have something different in your environment.

Try copy by example your ~/.bashrc in /home/www-data

If it's not sufficient, run this command both as your current user & as www-data:

strace -tt -f -s 1000 -o /tmp/trace ./script.py

And paste it (filter out your logins/passwords) somewhere.

We will see what's happens.


Sometimes, Firefox performs some nasty plugin compatibility check during startup. As each user can have a different set of browser plugins, this could be responsible for the difference in startup times. You could try to sync your Firefox profiles between users.

Then, are you sure that Firefox as user www-data has proper network/internet access? Can you confirm that the Flickr site loads properly via SeleniumHQ? "The script fails to log into Flickr" is too unprecise. Some more details about why it fails might reveal the problem instantaneously.

Edit: Sorry, I just understood that there shouldn't be a difference in profiles, because Selenium creates one. Nevertheless, my second point might be useful, so I won't delete this answer.


Some more things to ponder about:

  • Could you spawn firefox manually from www-data account once and make sure that Firefox is not updating itself before every execution of the script? I once faced this problem with Selenium RC on Windows and had to let the update finish before starting the script with the updated binary.

  • As a workaround, I guess you could you try running the script as www-data user but connecting remotely to a webdriver server running in your login (aka "grid" mode). Would that work for you?