I tried this Given select('select[name=data1]', '{}Option Two')
for selecting the dropdown select. I can see the changes in the select tag, but when click the submit button, it resetted to the default option.
I both tried these solutions. Don't work.
* def envName = 'env-rab'
* select('#environmentId', envName)
* script("document.getElementById('environmentId').value='" + env-rab + "'")
EDIT:
Change event triggered and the error message is :-
org.graalvm.polyglot.PolyglotException: js eval failed twice:(function(){ var e = document.querySelector("select[name=cars]"); var t = "Opel"; for (var i = 0; i < e.options.length; ++i) if (e.options[i].value === t) { e.options[i].selected = true; e.dispatchEvent(new Event('change')) } })(), error: [type: MAP, value: {type=object, subtype=error, className=TypeError, description=TypeError: Cannot read properties of null (reading 'options')