In my automated testing script, I am faced with the challenge of accounting for "chosen selects." My current approach involves using webdriver.io and referencing the API documentation available at
The specific task at hand is to trigger a click on 'a.chosen-single,' which in the context of "chosen" signifies a user interacting with a select element. This action directs the user's focus towards a text input field, enabling them to filter through options seamlessly - highlighting why the chosen feature is valuable. Subsequently, I aim to simulate the process of entering text as if done by a user.
However, the issue lies in my existing script, where all chosen-select elements are clicked first, followed by the keystrokes being entered afterward. Consequently, the text input values are only captured from the final chosen-select field.
To address this anomaly, I have incorporated a pause() function after each element click operation. Expecting the pause to occur following every click, it appears that the delay waits until all selections have been made before executing the keystrokes together towards the end, resulting in the last element having the combined value 'FIL12'.
this.click(container + ' a.chosen-single').then(function(){
console.log('clicked');
console.log('value', fields[selectName]);
this.pause(1000)
this.keys(fields[selectName])
//press enter to finalize selection
//.keys('\uE007')
console.log('keys pressed');
});
The terminal output reflects this behavior:
clicked
value F
keys pressed
clicked
value IL
keys pressed
clicked
value 1
keys pressed
clicked
value 2
keys pressed
I am seeking assistance in resolving this issue so that subsequent tasks do not queue up until the entire set of keystrokes has been effectively entered. Your help would be greatly appreciated.