form_autocomp
v1.0.8
Published
AutoComplete Website Formulary and create the result as an body array.
Downloads
3
Maintainers
Readme
~~ Form AutoComp ~~
[UPDATE 1.0.8] Added .getInputsTypes() method to get Input Names and Input Types
Form Autocom uses :
- Scrape Website HTML Form
- Find SRCF protections on Forms
- Prefill Website Form For POST registration requests
- Get Forms Input Names
Form autocomp.createCompletion() Exemple
(This example is using directly a body. You can send a full HTML website page and the form will be detected)
var autocomp = require("form_autocomp")
var body = `
<form action="/requests/register.php" method="POST">
<input type="text" id="name">
<input type="email" id="email">
<input type="text" id="firstname">
<input type="text" name="LastName">
<input type="text" name="LastName">
<input type="submit" value="Subscribe!">
</form>`
console.log(autocomp.createCompletion(body))
RESULT EXAMPLE :
{
errors: { error: 'false' },
prefilled: {
redirectFormUrl: '/requests/register.php',
name: 'Correa',
email: '[email protected]',
firstname: 'Bauer',
lastname: 'Serenity'
}
}
Form autocomp.getInputsTypes() Exemple
var autocomp = require("form_autocomp")
var body = `
<form action="/requests/register.php" method="POST">
<input type="text" id="name">
<input type="email" id="email">
<input type="text" id="firstname">
<input type="password" id="password">
<input type="text" name="LastName">
<input type="submit" value="Subscribe!">
</form>`
console.log(autocomp.getInputsTypes(body))
RESULT EXAMPLE :
{
errors: { error: 'false' },
prefilled: {
name: 'text',
email: 'email',
firstname: 'text',
password: 'password',
LastName: 'text'
}
}
Using Returned Example [Using request module]
var request = require("request");
var datas = autocomp.createCompletion(html_body);
request.post({
url: datas.redirectFormUrl,
form: datas.prefilled
}, function(error, response, body) {});
Form AutoComp Exemple [SENDING INVALID HTML VALUES]
var autocomp = require("form_autocomp")
var body = `
<label for="lastname">Enter your LastName: >
<input type="submit" value="Subscribe!">
</form>`
console.log(autocomp.createCompletion(body))
RESULT EXAMPLE :
{
errors: {
error: true,
message: 'no body found'
}
}