@@ -2167,7 +2167,7 @@ class TargetLocator {
2167
2167
* @return {!WebElementPromise } The active element.
2168
2168
*/
2169
2169
activeElement ( ) {
2170
- var id = this . driver_ . execute (
2170
+ const id = this . driver_ . execute (
2171
2171
new command . Command ( command . Name . GET_ACTIVE_ELEMENT )
2172
2172
)
2173
2173
return new WebElementPromise ( this . driver_ , id )
@@ -2259,7 +2259,7 @@ class TargetLocator {
2259
2259
* when the driver has changed focus to the new window.
2260
2260
*/
2261
2261
newWindow ( typeHint ) {
2262
- var driver = this . driver_
2262
+ const driver = this . driver_
2263
2263
return this . driver_
2264
2264
. execute (
2265
2265
new command . Command ( command . Name . SWITCH_TO_NEW_WINDOW ) . setParameter (
@@ -2281,10 +2281,10 @@ class TargetLocator {
2281
2281
* @return {!AlertPromise } The open alert.
2282
2282
*/
2283
2283
alert ( ) {
2284
- var text = this . driver_ . execute (
2284
+ const text = this . driver_ . execute (
2285
2285
new command . Command ( command . Name . GET_ALERT_TEXT )
2286
2286
)
2287
- var driver = this . driver_
2287
+ const driver = this . driver_
2288
2288
return new AlertPromise (
2289
2289
driver ,
2290
2290
text . then ( function ( text ) {
@@ -2614,7 +2614,7 @@ class WebElement {
2614
2614
* requested CSS value.
2615
2615
*/
2616
2616
getCssValue ( cssStyleProperty ) {
2617
- var name = command . Name . GET_ELEMENT_VALUE_OF_CSS_PROPERTY
2617
+ const name = command . Name . GET_ELEMENT_VALUE_OF_CSS_PROPERTY
2618
2618
return this . execute_ (
2619
2619
new command . Command ( name ) . setParameter ( 'propertyName' , cssStyleProperty )
2620
2620
)
@@ -2758,7 +2758,10 @@ class WebElement {
2758
2758
* when the form has been submitted.
2759
2759
*/
2760
2760
submit ( ) {
2761
- return this . execute_ ( new command . Command ( command . Name . SUBMIT_ELEMENT ) )
2761
+ const form = this . findElement ( { xpath :"./ancestor-or-self::form" } ) ;
2762
+ this . driver_ . executeScript ( "var e = arguments[0].ownerDocument.createEvent('Event');" +
2763
+ "e.initEvent('submit', true, true);" +
2764
+ "if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }" , form )
2762
2765
}
2763
2766
2764
2767
/**
0 commit comments