在AWS Ubuntu上运行Selenium - 错误:无法在系统路径中找到firefox

时间:2017-06-25 01:00:42

标签: python amazon-web-services selenium ubuntu

我在AWS Ubuntu Server 16.04 LTS实例上使用selenium版本2.53.6和firefox 46.0.1运行python 2.7.12。我已经安装了pyvirtualdisplay。

当我运行此代码时:

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(1024, 768))
display.start()
driver = webdriver.Firefox()

我收到此错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site- packages/selenium/webdriver/firefox/webdriver.py", line 55, in __init__
self.binary = firefox_binary or capabilities.get("binary", FirefoxBinary())
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 47, in __init__
self._start_cmd = self._get_firefox_start_cmd()
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 163, in _get_firefox_start_cmd
" Please specify the firefox binary location or install firefox")
RuntimeError: Could not find firefox in your system PATH. Please specify the firefox binary location or install firefox

我已尝试添加指向我的bash个人资料的链接

echo export 'PATH="$PATH:/home/firefox"' >> ~/.bashrc
但是没有成功。任何帮助将不胜感激。

0 个答案:

没有答案