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

【记录】尝试用PhantomJS去模拟浏览器操作

浏览器 crifan 3468浏览 0评论

折腾:

【记录】尝试用Python操作PhantomJS+Selenium去模拟购物操作

期间,去尝试用PhantomJS去实现模拟浏览器的操作。

PhantomJS | PhantomJS

ariya/phantomjs: Scriptable Headless WebKit

Documentation | PhantomJS

Download | PhantomJS

-》

phantomjs-2.1.1-macosx.zip

-》

Quick Start | PhantomJS

Examples | PhantomJS

Page Automation | PhantomJS

REPL | PhantomJS

去试试

另外值得参考的帖子有:

Introduction to Headless Browser Testing – LogRocket

<code>  ~ /Users/crifan/dev/dev_tool/Headless\ Browser/phantomjs-2.1.1-macosx/bin
➜  bin ./phantomjs
phantomjs&gt; phantom.version
{
   "major": 2,
   "minor": 1,
   "patch": 1
}
phantomjs&gt; console.log("this is crifan")
this is crifan
undefined
phantomjs&gt; window.navigator
{
   "appCodeName": "Mozilla",
   "appName": "Netscape",
   "appVersion": "5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1",
   "cookieEnabled": true,
   "language": "zh-CN",
   "mimeTypes": {
      "length": 0
   },
   "onLine": true,
   "platform": "MacIntel",
   "plugins": {
      "length": 0
   },
   "product": "Gecko",
   "productSub": "20030107",
   "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1",
   "vendor": "Apple Computer, Inc.",
   "vendorSub": ""
}
phantomjs&gt;
</code>

phantomjs模拟鼠标点击

Python selenium —— 模拟鼠标键盘操作(ActionChains) « 灰蓝

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

Selenium+phantomjs模拟网页自动化操作 – Hi!Roy!

python selenium的模拟点击,模拟滑动等操作 – CSDN博客

用python玩转selenium:2-入门实例及分析 – CSDN博客

运用phantomjs无头浏览器破解四种反爬虫技术 – Python – 伯乐在线

phantomjs API 中文版 无界面浏览器 js处理的爬虫 | | URl-team

phantomjs模拟鼠标点击时间,如何知道时间的坐标 部落 水木社区

selenium和phantomjs爬取动态网页_慕课手记

如何在前端自动化测试中模拟用户的操作? – 知乎

所以去:

selenium

selenium python

SeleniumHQ/selenium: A browser automation framework and ecosystem.

Selenium – Web Browser Automation

Selenium Documentation — Selenium Documentation

Selenium with Python — Selenium Python Bindings 2 documentation

2. Getting Started — Selenium Python Bindings 2 documentation

2. 快速入门 — Selenium-Python中文文档 2 documentation

selenium 3.7.0 : Python Package Index

Python爬虫利器五之Selenium的用法 | 静觅

“PhantomJS 用来渲染解析JS,Selenium 用来驱动以及与 Python 的对接,Python 进行后期的处理,完美的三剑客!

有人问,为什么不直接用浏览器而用一个没界面的 PhantomJS 呢?答案是:效率高!

Selenium 2,又名 WebDriver,它的主要新功能是集成了 Selenium 1.0 以及 WebDriver(WebDriver 曾经是 Selenium 的竞争对手)。也就是说 Selenium 2 是 Selenium 和 WebDriver 两个项目的合并,即 Selenium 2 兼容 Selenium,它既支持 Selenium API 也支持 WebDriver API。”

然后才知道原来是:

主要通过selenium去实现自动化操作的,其中浏览器的内核,可以选用Chrome/Firefox/PhantomJS等等

所以继续回去折腾:

【记录】尝试用Python操作PhantomJS+Selenium去模拟购物操作

转载请注明:在路上 » 【记录】尝试用PhantomJS去模拟浏览器操作

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.176 seconds, using 22.13MB memory