Module: selenium-webdriver
View Source

# class WebElementPromise

    webdriver.Serializable<{ELEMENT: string}>
      └ webdriver.WebElement
          └ WebElementPromise

Alias for `webdriver.WebElementPromise`
All implemented interfaces:
  `webdriver.promise.Thenable<webdriver.WebElement>`

WebElementPromise is a promise that will be fulfilled with a WebElement. This serves as a forward proxy on WebElement, allowing calls to be scheduled without directly on this instance before the underlying WebElement has been fulfilled. In other words, the following two statements are equivalent:

    driver.findElement({id: 'my-button'}).click();
    driver.findElement({id: 'my-button'}).then(function(el) {
      return el.click();
    });

## new WebElementPromise(driver, el)

Parameters

driver`webdriver.WebDriver`

  The parent WebDriver instance for this element.

el`webdriver.promise.Promise<webdriver.WebElement>`

  A promise that will resolve to the promised element.

## Instance Methods

### cancel(arg0)code »

Specified by: webdriver.promise.Thenable

Parameters

arg0`?(string|webdriver.promise.CancellationError)=`

### getId()code »

Defers returning the element ID until the wrapped WebElement has been resolved.

Overrides: webdriver.WebElement

### isPending()code »

Specified by: webdriver.promise.Thenable

Returns

`boolean`

### then(arg0, arg1)code »

Specified by: webdriver.promise.Thenable

Parameters

arg0`?function(webdriver.WebElement): (R|IThenable<R>)=`
arg1`?function(*): (R|IThenable<R>)=`

Returns

`webdriver.promise.Promise`

### thenCatch(arg0)code »

Specified by: webdriver.promise.Thenable

Parameters

arg0`function(*): (R|IThenable<R>)`

Returns

`webdriver.promise.Promise`

### thenFinally(arg0)code »

Specified by: webdriver.promise.Thenable

Parameters

arg0`function(): (R|IThenable<R>)`

Returns

`webdriver.promise.Promise`