问题
I'm attempting to do a simple select, then next page scenario.
I am able to successfully select the option with the follow ie:
* select('#detectorType', 'VECTOR_SPACE_EXPANDED')
or
* select('select[id=detectorType]', 1)
I can see the menu options change on the UI.
However, when I complete the form and go the next page, only the default selection is applied (the first one on the list).
I also tried doing a script as per the w3.org. No luck either. Manual intervention works.
Why isn't the selected option being applied?
回答1:
Most likely because of a lot of fancy JavaScript on the page. No one can tell unless there is a way to simulate. The best option is for you to submit an example using this process: https://github.com/intuit/karate/tree/develop/examples/ui-test
That said, see if firing a onChanged
event manually will get you going. See this answer for details: https://stackoverflow.com/a/60800181/143475
For example as given in the docs: https://github.com/intuit/karate/tree/develop/karate-core#script
* waitFor('#someId').script("_.dispatchEvent(new Event('change'))")
来源:https://stackoverflow.com/questions/63222852/karate-ui-selected-option-not-applied-on-next-page