Form Submit Action API Reference ๐
Introduction ๐
The FormSubmit
action allows you to submit forms on a web page. This is part of the core
package in Go-Ski.
Syntax ๐
Here's how you define a FormSubmit
action:
Action{
Type: core.FormSubmit,
FormDetails: &core.FormDetails{
Fields: []core.FormField{
{XPath: "/html/form/p[1]/input", Value: "example_user"},
{XPath: "/html/form/p[2]/input", Value: "example_password"},
},
Submit: "/html/body/main/div[2]/fieldset/form/input",
Delay: 1 \* time.Second,
},
}
Parameters ๐ ๏ธ
Type
: Should be set tocore.FormSubmit
.FormDetails
: A struct containing the details for form submission.
Example ๐
Here's a simple example that submits a form:
Action{
Type: core.FormSubmit,
FormDetails: &core.FormDetails{
Fields: []core.FormField{
{XPath: "/html/form/p[1]/input", Value: "example_user"},
{XPath: "/html/form/p[2]/input", Value: "example_password"},
},
Submit: "/html/body/main/div[2]/fieldset/form/input",
Delay: 1 \* time.Second,
},
}
Conclusion ๐
The FormSubmit
action is crucial for interacting with web pages that require form submissions. It allows you to automate the process of filling out and submitting forms.
For the complete example, you can check out the Go-Ski GitHub Repository (opens in a new tab).