Skip to content
Advertisement

unable to call firefox from selenium in python on AWS machine

I am trying to use selenium from python to scrape some dynamics pages with javascript. However, I cannot call firefox after I followed the instruction of selenium on the pypi page(http://pypi.python.org/pypi/selenium). I installed firefox on AWS ubuntu 12.04. The error message I got is:

JavaScript

I did search on the web and found that this problem happened with other people (https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/21sJrOJULZY). But I don’t understand the solution, if it is.

Can anyone help me please? Thanks!

Advertisement

Answer

The problem is Firefox requires a display. I’ve used pyvirtualdisplay in my example to simulate a display. The solution is:

JavaScript

Please note that pyvirtualdisplay requires one of the following back-ends: Xvfb, Xephyr, Xvnc.

This should resolve your issue.

Advertisement