0

I have two forms, first is Login Form and the second is Purchase Form as below:

<form id="login-form">
    <div>
        <label for="username">Username</label>
        <input type="text" name="username" required="true">
    </div>
    <div>
        <label for="password">Password</label>
        <input type="password" name="password" required="true">
    </div>
</form>

In K6, the script I use to submit the form is as below and there is not issue in getting response for login form

response.submitForm({
    formSelector: '#login-form',
    fields: { username: 'myusername', password: 'mypassword' }
})

But I have problem submitting Purchase Form.

<form id="purchase-form" @submit.prevent="submit-form">
    <div>
        <label for="product">Product Name</label>
        <input type="text" name="productName" required="true">
    </div>
    <div>
        <label for="price">Product Price</label>
        <input type="text" name="productPrice" required="true">
    </div>
    <div>
        <button type="button" @click="submit()" text="submit-button">Submit</button>
        <button type="button" @click="cancel()">Cancel</button>
    </div>
</form>

Here to submit the purchase form, what is the K6 script or code I should apply to submit the form on the button @click?

Joven Dev
  • 189
  • 2
  • 14

0 Answers0