You cannot click (trigger a click event) in the options of the selection window. You need to change the selected option and then fire the change event . For instance:
var sel = document.querySelector('select.se1'); sel.selectedIndex = 2; var event = new UIEvent("change", { "view": window, "bubbles": true, "cancelable": true }); sel.dispatchEvent(event);
You can pack it into a function
function selectOption(selector, optionIndex) { page.evaluate(function(selector, optionIndex){ var sel = document.querySelector(selector); sel.selectedIndex = optionIndex; var event = new UIEvent("change", { "view": window, "bubbles": true, "cancelable": true }); sel.dispatchEvent(event); }, selector, optionIndex); }
Then you can call it one by one
selectOption("select.se1", 2); selectOption("select.se2", 0); selectOption("select.se3", 0); ...
You get the idea. In case the onChange event in the selection field needs remote data, for example, via AJAX, you will need to wait between calls. Use either a static wait time (see the following example) or use waitFor() .
setTimeout(function(){ selectOption("select.se1", 2); }, 1000); setTimeout(function(){ selectOption("select.se2", 0); }, 2000); setTimeout(function(){ selectOption("select.se3", 0); }, 3000); ...