* 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.
()
| 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 |
nothing calls this directly
no test coverage detected