selenium 的 webdriver 的问题

2017 年 11 月 23 日
 capturepointer

我想在 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 下面,可行吗?

2555 次点击
所在节点    Python
3 条回复
capturepointer
2017 年 11 月 23 日
已经解决了,因为我 windows 上面安装了 firefox,也需要在 ubuntu server 上面安装 firefox
iyaozhen
2017 年 11 月 23 日
server 也能安装 Firefox ?

话说怎么启动无界面模式呢?
vipper
2017 年 11 月 24 日
PhantomJs 支持无界面

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.ih06.com/t/409021

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX