I’m going through the documentation for the Selenium WebDriver, and it can drive Chrome for example. I was thinking, wouldn't it be far more efficient to ‘drive’ PhantomJS?
我正在阅读Selenium WebDriver的文档,例如它可以驱动Chrome。我在想,“驾驶”PhantomJS会不会更有效率?
Is there a way to use Selenium with PhantomJS?
有没有办法使用Selenium和PhantomJS?
My intended use would be web scraping: The sites I scrape are loaded with AJAX and lots of lovely JavaScript, and I’m thinking this setup could be a good replacement for the Scrapy Python framework that I’m currently working with.
我的预期用途是网页抓取:我抓的网站加载了AJAX和许多可爱的JavaScript,我认为这个设置可能是我正在使用的Scrapy Python框架的一个很好的替代品。
2 个解决方案
#1
56
PhantomJS now includes the GhostDriver project.
PhantomJS现在包含GhostDriver项目。
You are also suggested to use PhantomJS directly or with a convenience library such as CasperJS. CasperJS is specifically designed to make it easy to do sequential operations to web pages, perfect for many automation tasks.
您还建议您直接使用PhantomJS或使用CasperJS等便利库。 CasperJS专门设计用于轻松对网页执行顺序操作,非常适合许多自动化任务。
Disclaimer: I am the author of PhantomJS.
免责声明:我是PhantomJS的作者。
Edit: As noted in Nick's answer, GhostDriver is now included in PhantomJS.
编辑:正如Nick的回答所述,GhostDriver现在包含在PhantomJS中。
#2
21
@Joseph, since the 1.8 release GhostDriver is included in the stable release of PhantomJS. Here is the exact release notes: http://phantomjs.org/release-1.8.html. You can simply start PhantomJS process to listen on some port, like this:
@Joseph,自1.8版本发布GhostDriver以来都包含在PhantomJS的稳定版本中。以下是确切的发行说明:http://phantomjs.org/release-1.8.html。您可以简单地启动PhantomJS进程来侦听某些端口,如下所示:
phantomjs --webdriver=PORT
Kudos to @detro and PhantomJS team for awesome work!
感谢@detro和PhantomJS团队的出色工作!
#1
56
PhantomJS now includes the GhostDriver project.
PhantomJS现在包含GhostDriver项目。
You are also suggested to use PhantomJS directly or with a convenience library such as CasperJS. CasperJS is specifically designed to make it easy to do sequential operations to web pages, perfect for many automation tasks.
您还建议您直接使用PhantomJS或使用CasperJS等便利库。 CasperJS专门设计用于轻松对网页执行顺序操作,非常适合许多自动化任务。
Disclaimer: I am the author of PhantomJS.
免责声明:我是PhantomJS的作者。
Edit: As noted in Nick's answer, GhostDriver is now included in PhantomJS.
编辑:正如Nick的回答所述,GhostDriver现在包含在PhantomJS中。
#2
21
@Joseph, since the 1.8 release GhostDriver is included in the stable release of PhantomJS. Here is the exact release notes: http://phantomjs.org/release-1.8.html. You can simply start PhantomJS process to listen on some port, like this:
@Joseph,自1.8版本发布GhostDriver以来都包含在PhantomJS的稳定版本中。以下是确切的发行说明:http://phantomjs.org/release-1.8.html。您可以简单地启动PhantomJS进程来侦听某些端口,如下所示:
phantomjs --webdriver=PORT
Kudos to @detro and PhantomJS team for awesome work!
感谢@detro和PhantomJS团队的出色工作!