我想在 ubuntu server 下面,基于 selenium 的 webdriver 开发没有界面的爬虫,chrome 和 firefox 现在支持无界面 headless,但是在 windows 下面没有问题,在 ubuntu server 下面一直有问题,如下:
File "firefox.py", line 39, in <module> driver = webdriver.Firefox() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 154, in init keep_alive=True) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 151, in init self.start_session(desired_capabilities, browser_profile) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute self.error_handler.check_response(response) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities
求教下,在 ubuntu server 下面,可行吗?
1
capturepointer OP 已经解决了,因为我 windows 上面安装了 firefox,也需要在 ubuntu server 上面安装 firefox
|
2
iyaozhen 2017-11-23 22:04:58 +08:00 via Android
server 也能安装 Firefox ?
话说怎么启动无界面模式呢? |
3
vipper 2017-11-24 07:53:44 +08:00 via iPhone
PhantomJs 支持无界面
|