最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】Mac中Selenium换用PhantomJS去模拟浏览器操作

Mac crifan 2509浏览 0评论

之前已经实现了,Mac下的用Selenium使用chromedriver去实现模拟浏览器操作。

现在去试试,换用,据说速度更快的(无界面的headless 浏览器 )PhantomJS去看看效果。

selenium phantomJS

python爬虫的最佳实践(五)–selenium+PhantomJS的简单使用 – 简书

盘点selenium phantomJS使用的坑 – 简书

Download | PhantomJS

Selenium phantomjs – Python Tutorial

基于selenium+phantomJS的动态网页抓取 | DejaVu

Selenium with Python — Selenium Python Bindings 2 documentation

python爬虫积累(一)——–selenium+python+PhantomJS的使用 – 今孝 – 博客园

1. Installation — Selenium Python Bindings 2 documentation

好像对于driver没有提到PhantomJS

7. WebDriver API — Selenium Python Bindings 2 documentation

WebDriver的API中提到了PhantomJS

先去

http://phantomjs.org/download.html

下载:

https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip

Quick Start | PhantomJS

下载解压后bin目录下有对应的二进制文件:phantomjs

去看看版本:

➜  mac git:(master) ✗ ./phantomjs –version

2.1.1

然后去运行试试效果

结果虽然:

driver = webdriver.PhantomJS()

可以初始化PhantomJS的driver,但是由于没有页面可以看到,

之前Chrome的driver可以正常执行的页面,此处就出错了:

【已解决】Selenium中PhantomJS出错:selenium.common.exceptions.ElementNotVisibleException Message errorMessage Element is not currently visible and may not be manipulated

然后貌似就可以正常的继续执行了:

此处暂时还没来得及完全测试一遍,目前测的部分代码,是可以正常运行的。

后续再测试全部代码,看看是否都能不改动的情况下正常执行。

转载请注明:在路上 » 【未解决】Mac中Selenium换用PhantomJS去模拟浏览器操作

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.172 seconds, using 22.10MB memory