简体   繁体   English

Node.js是否相当于Perl的WWW :: Mechanize?

[英]Is there a Node.js equivalent of Perl's WWW::Mechanize?

I'm searching a module for Node which would be similar to WWW::Mechanize for Perl. 我正在搜索Node的模块,它类似于WWW :: Mechanize for Perl。 Or even better to WWW::Mechanize::Firefox . 甚至更好的WWW :: Mechanize :: Firefox

  • The main functionality would be to find and submit form by name, class or id. 主要功能是按名称,类或ID查找和提交表单。
  • The ability to handle cookies would be great 处理cookie的能力会很棒
  • and the ability to handle Javascript would be perfect. 并且处理Javascript的能力将是完美的。

If anyone had an idea of something similar, or in which direction I could search, that would really be appreciated. 如果有人知道类似的东西,或者我可以搜索哪个方向,那真的很感激。

What you're looking for is a scriptable/headless browser. 您正在寻找的是可编写脚本/无头的浏览器。 In decreasing order of popularity, the options are: 按受欢迎程度递减,选项包括:

  • Google Puppeteer - "Node library which provides a high-level API to control Chrome or Chromium" Google Puppeteer - “节点库,提供高级API来控制Chrome或Chromium”
  • Zombie - more lightweight; 僵尸 - 更轻巧; "Insanely fast, headless full-stack testing using Node.js" “使用Node.js疯狂快速,无头全栈测试”
  • slimerjs - scriptable Firefox. slimerjs - 可编写脚本的Firefox。 No commits since March 2018. 自2018年3月以来没有提交。
  • mechanize-js , which lacks documentation and has far less traction than any of the above alternatives mechanize-js ,缺乏文档,并且牵引力远远低于上述任何替代方案

Abandoned projects 被遗弃的项目

试试mechanize-js - 名字说明了一切......

The closest tool I have found for now is zombie . 我现在找到的最接近的工具是僵尸

Apparently it is not exactly ready for production (and may never be) as it is a testing tool. 显然它还没有完全准备好生产(并且可能永远不会),因为它是一种测试工具。 Nevertheless it seems that it is the closest match for the functionality needed (and it supports JS!) 然而,它似乎是最接近所需功能的匹配(它支持JS!)

you can embed perl script in node.js use: 你可以在node.js中嵌入perl脚本使用:

npm install exec_perl npm install exec_perl

see: https://github.com/tlqtangok/exec_perl 请参阅: https//github.com/tlqtangok/exec_perl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM