Filling out a signup page that checks to see if it was auto filled. I spent half the day and fount a code that worked for the text boxes posted by wOxxOm.
document.getElementsByClassName('form-control')[4].focus();
document.execCommand('selectAll');
document.execCommand('insertText', false, 'My City');
Well below this I have document.getElementsByClassName('form-control')[5]. This is a dropdown state selection. When I use the execCommand to send [5] letters they are sent back to [4]. I think it has to do with the .focus() not working on the dropdown selection. I have tried everything from jnode changes, val changes, and triggerMouseEvent. Also getelementBy/ID or NAME is not possible except thru option form-control with a number selection as they change every new visit except for form-control[1]-[8].
waitForKeyElements (".form-control:has(option[value=AL])", selectDropdown);
function selectDropdown (jNode) {
var evt = new Event ("click");
jNode[0].dispatchEvent (evt);
jNode.val('AK');
evt = new Event ("change");
jNode[0].dispatchEvent (evt);
}
I posted this because it works until I click submit then the input is removed. I do believe a mouse selection should be able to work, but I am just at a loss right now. Any help would be appreciated.