API Reference
Form Submit

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 to core.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).