Skip to content

Mechanize is a Javascript library that enables automated web interaction.

License

Notifications You must be signed in to change notification settings

srveit/mechanize-js

Repository files navigation

mechanize

NPM Version NPM Downloads MIT License Node.js Version GitHub Build Status Codecov Status Code Climate Gitter Known Vulnerabilities

The Mechanize module is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history.

Getting Started

From the root folder, you can run the get_page example:

node examples/get_page.js

To load from a specific URL:

node examples/get_page.js "http://www.cnn.com"

The example gets the page and then performs a console.log() on all of the returned object data.

Posting a form

For form posting, you can run the submit_form example:

node examples/submit_form.js "http://localhost/"

The example POSTs a username and password to the /login path at the specificied URL.

Chaining page accesses

For an example of chaining requests, you can run the submit_form_chain example:

node examples/submit_form_chain.js

Installation

From the mechanize directory, run npm install:

npm install

Dependencies

jsdom >= 19.0.0
mime >= 3.0.0
node-fetch >= 2.6.7
tough-cookie >= 4.0.0
unescape >= 1.0.1
windows-1252 >= 1.1.0

Documentation

mechanize-js

Credits

This borrows heavily from Aaron Patterson's mechanize Ruby gem.

Contributors

  • 佐藤
  • Dan Rahmel
  • Anders Hjelm

About

Mechanize is a Javascript library that enables automated web interaction.

Resources

License

Stars

Watchers

Forks

Packages

No packages published