MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / submit

Method submit

javascript/selenium-webdriver/lib/webdriver.js:3117–3130  ·  view source on GitHub ↗

* Submits the form containing this element (or this element if it is itself * a FORM element). his command is a no-op if the element is not contained in * a form. * * @return {!Promise } A promise that will be resolved * when the form has been submitted.

()

Source from the content-addressed store, hash-verified

3115 * when the form has been submitted.
3116 */
3117 submit() {
3118 const script =
3119 '/* submitForm */var form = arguments[0];\n' +
3120 'while (form.nodeName != "FORM" && form.parentNode) {\n' +
3121 ' form = form.parentNode;\n' +
3122 '}\n' +
3123 "if (!form) { throw Error('Unable to find containing form element'); }\n" +
3124 "if (!form.ownerDocument) { throw Error('Unable to find owning document'); }\n" +
3125 "var e = form.ownerDocument.createEvent('Event');\n" +
3126 "e.initEvent('submit', true, true);\n" +
3127 'if (form.dispatchEvent(e)) { HTMLFormElement.prototype.submit.call(form) }\n'
3128
3129 return this.driver_.executeScript(script, this)
3130 }
3131
3132 /**
3133 * Clear the `value` of this element. This command has no effect if the

Callers

nothing calls this directly

Calls 1

executeScriptMethod · 0.65

Tested by

no test coverage detected