Search code examples
javascriptvue.jsvue-componentrobotframework

How can I set vue.js input element via JS


I have a input made by vue.js's built-in components. I want to be able to set a value and submit this value to be able to create automated tests. How can I accomplish this?

Currently this is how I set value, but on submit this value is changed with the default data automatically.

    Execute JavaScript    return element.value = "${startDate}"

Solution

  • Simply run dispatchEvent method on the component itself. This will let Vue to set the value that you've entered to the form data

    Execute JavaScript    return element.dispatchEvent(new Event('input'));