I've searched this group with 'javascript form submission' but didn't find anything relevant. I've got a complicated form that doesn't have a submit button; its submitted by clicking on an icon. and When using selenium form.submit() it fires but its empty. Apparently there is a lot of javascript that preps the form first, via jquery widget code. WebElement click doesn't submit the form either.
I'm headed toward trying to understand the jquery widget code and prep the form first, but before I do that I was hoping to ask the following.
Here is the javascript that I'm trying to run:
var sClick = document.createEvent('MouseEvents');
sClick.initMouseEvent('click', true, false, window, 1, arguments[1], arguments[2], arguments[1], arguments[2], false, false, false, false, 0, null); $(arguments[0])[0].dispatchEvent(sClick);
argument[0] cssSelector
argument 1 and 2 window relative coordinates
where the arguments are for the executeScript method. The corresponding code will work correctly when submitted to the Firefox console, which is the browser used by my driver.
Is it my luck that you can't navigate off a page in javascript via the Executor? Is there some basic rule that says you can't submit a form or leave a page under javascript? I know that you can issue a browser back js command, but am I missing somehting obvious?
Thanks for any help!