I’m trying to load test a form using K6. I have used K6 for rest, XML, website URL, but have not done that of form. This is my first time of trying to use K6 to load test HTML forms.
I tried to follow the example provided but always getting this error.
Error that I’m getting
ERRO[0003] GoError: no form found for selector ‘form’ in response ‘https://vpn.wesite.com:1234/caps/tes?URL=domain&strTitle=applyRule’
at reflect.methodValueCall (native)-
at file:///C:/Users/GEGE/Documents/project/k6/submit-form.js:11:23(18) executor=per-vu-iterations scenario=default source=stacktrace
The form name (findMatch) is what I’m using as the selector, and I’m using the field id (acctNo)
Modified example code
import http from ‘k6/http’;
import { sleep } from ‘k6’;export default function () {
// Request page containing a form
let res = http.post(‘https://vpn.wesite.com:1234/caps/tes?URL=domain&strTitle=applyRule’);// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: ‘findMatch’,
fields: { acctNo: ‘1300000823’ },
});
sleep(3);
}
How do I make this work, please? Time is fastly running against me on this.