https://github.com/tokenrove/mechanizerl
Web testing tool for Erlang modelled after WWW::Mechanize
https://github.com/tokenrove/mechanizerl
Last synced: about 1 year ago
JSON representation
Web testing tool for Erlang modelled after WWW::Mechanize
- Host: GitHub
- URL: https://github.com/tokenrove/mechanizerl
- Owner: tokenrove
- License: gpl-3.0
- Created: 2012-11-10T21:50:03.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-09-26T17:14:46.000Z (almost 11 years ago)
- Last Synced: 2025-04-03T19:47:06.750Z (over 1 year ago)
- Language: Erlang
- Size: 122 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: COPYING
Awesome Lists containing this project
README
mechanizerl
===========
A clone of WWW::Mechanize for Erlang, with perhaps a bit of
Test::WWW::Mechanize and Webtest for good measure. Named according to
the seeming defacto convention of inserting "erl" in silly places in
the name. This is primarily a convenience wrapper around httpc.
Examples:
---------
.. code-block:: erlang
erl -pa ebin -boot start_sasl -s inets -s xmerl -s mechanizerl
1> Mech = mechanizerl:new().
{mechanizerl,<0.64.0>}
2> Mech:get("http://google.com/").
ok
3> Mech:submit_form("search", [{q, "mechanizerl"}]).
ok
4> Mech:body().
<<"...">>
Caveats:
--------
* The interface isn't as Erlangy as it could be (it uses the lowly
tuple calls), as I tried to follow the WWW::Mechanize API closely to
facilitate translating old tests I had written in perl into Erlang.
Part of the efficacy of Mechanize's interface is its statefulness.
* This uses xmerl to parse the HTML it receives. This works for me,
since I tend to write HTML in an XHTML-ish fashion, but be warned that
it will choke on lots of other HTML. I considered using one of the
HTML parsers from YAWS or Mochiweb, but it seemed unnecessary for my
purposes.
* Strings are used throughout rather than binaries, for convenience
rather than efficiency.
* I've only implemented so far the subset of WWW::Mechanize's
functionality that I actually use. For example, cookies are always
enabled. Patches Thoughtfully Considered.
* Lists are used in numerous places where more sophisticated data
structures would be more efficient. Making the simplest thing that
would work trumped efficiency in this first version.
To do:
------
* Enforce constraints on fields (select options, maxlength, et
cetera);
* More extensive testing: replay-based testing of redirects, et
cetera;
* File upload;
* Examples and documentation.
Contact
-------
Julian Squires