This project allows automated responses to a form.
To use it, clone the repository :
git clone [email protected]:kiitoss/form-bot.git
cd form-bot
Then, add a data.json
file containing a structure similar to the data-sample.json
file.
Then run the project using :
python3 main.py
The JSON object contains 2 attributes:
url
: url of the form to be filled in automaticallyinstructions
: a list of instructions to be performed
{
"url": "https://xxx.com", // url of the form
"repetitions": 5, // nb of forms to be sent
"instructions": [
// page 1
[
{
"selector": "button[type='submit']",
"action": "click"
}
],
// page 2
[
{
"selector": ".radio-button",
"action": "click"
},
{
"selector": ".textarea.content",
"action": "write",
"value": "This is the new content of the textarea."
},
{
"selector": "button[type='submit']",
"action": "click"
}
]
]
}
The instructions are grouped in sub-lists to visually separate the pages of a form.
A statement can contain the following properties:
selector
: the css selector of the HTML elementaction
: the action to be performed on the selected elementvalue
: (optional) the value used for the action
The possible actions are :
click
: click on the selected object
{
"selector": "button[type='submit']",
"action": "click"
}
write
: write the value contained in the "value" attribute
{
"selector": ".textarea.content",
"action": "write",
"value": "This is the new content of the textarea."
}