javascript - 在不中断 session 的情况下将 deathbycaptcha 与 phantomjs 一起使用

标签 javascript testing phantomjs captcha headless-browser

考虑到 PhantomJS 不完全是 node.js(因此像 deathbycaptcha2 这样的模块)因为它们使用 native 请求而被淘汰,是否可以简单地打开 webpage 的另一个实例并使用它来在不影响其他页面实例的情况下向验证码 API 发送 POST 请求?

这个新的 page.open() 会保留第一页收集的 cookie 吗?

最佳答案

Will this new page.open() retain cookies collected by the first page?

是的,每个 PhantomJS 进程只有一个 CookieJar。因此,您创建的每个 页面 共享相同的 cookie。将那些 page 实例视为传统浏览器中的窗口或选项卡。

[I]s it possible to simply open another instance of webpage and use it to send POST requests to the captcha API without affecting the other page instance?

这并不容易,因为 cookie 是共享的。如果您不访问相同的页面,您可以安全地创建第二个实例。如果你想在第二个实例中访问同一个页面,那么你可以通过 child_process module 启动第二个 PhantomJS 进程。 (例如使用 execFile)。

Considering that PhantomJS isn't exactly node.js [...]

是的,但是 PhantomJS 和 node.js 之间有几个桥梁,例如 phantom , node-phantom , nightmare等。您可以使用它们与 PhantomJS 交互,并另外调用您想要的节点模块。

关于javascript - 在不中断 session 的情况下将 deathbycaptcha 与 phantomjs 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32364092/

相关文章:

javascript - 将第 3 方 Flash 组件集成到 Adob​​e Air 应用程序中?

Javascript 引用通配符对象名称

javascript - 如何在解析服务器javascript sdk中递减

angularjs - Karma-webpack:未知提供者:LeaveServiceProvider <- LeaveService

phantomjs - 在 PhantomJS 和 Protractor 中设置用户代理

javascript - 设置 prerender.io 只输出来自 PhantomJS 的错误消息

javascript - 项目中 JavaScript 的良好结构?

python-3.x - 如何将 body 发送到 Falcon 中的 simulate_post

testing - 简单模拟 - 如何?

javascript - 无法打开 https,尤其是 phantomjs 中的 salesforce 站点