Implement ShadowRootPromise

### Hierarchy

- Promise<ShadowRoot>
- ShadowRoot
  - ShadowRootPromise

## Index

### Constructors

- constructor

### Properties

- [toStringTag]

### Methods

- catch
- finally
- findElement
- findElements
- getId
- serialize
- then
- extractId
- isId

## Constructors

### constructor

- new ShadowRootPromise(driver: WebDriver, shadow: Promise<ShadowRoot>): ShadowRootPromise

- Inherited from ShadowRoot.constructor

  #### Parameters

  - ##### driver: WebDriver

    The parent WebDriver instance for this element.

  - ##### shadow: Promise<ShadowRoot>

    A promise that will resolve to the promised element.

  #### Returns ShadowRootPromise

## Properties

### Readonly [toStringTag]

[toStringTag]: string

Inherited from Promise.__@toStringTag@91

## Methods

### catch

- catch<TResult>(onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<ShadowRoot | TResult>

- Inherited from Promise.catch

  Attaches a callback for only the rejection of the Promise.

  #### Type parameters

  - #### TResult = never

  #### Parameters

  - ##### Optional onrejected: (reason: any) => TResult | PromiseLike<TResult>

    The callback to execute when the Promise is rejected.

    - - (reason: any): TResult | PromiseLike<TResult>

      - #### Parameters

        - ##### reason: any

        #### Returns TResult | PromiseLike<TResult>

  #### Returns Promise<ShadowRoot | TResult>

  A Promise for the completion of the callback.

### finally

- finally(onfinally?: () => void): Promise<ShadowRoot>

- Inherited from Promise.finally

  Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

  #### Parameters

  - ##### Optional onfinally: () => void

    The callback to execute when the Promise is settled (fulfilled or rejected).

    - - (): void

      - #### Returns void

  #### Returns Promise<ShadowRoot>

  A Promise for the completion of the callback.

### findElement

- findElement(locator: Locator): WebElementPromise

- Inherited from ShadowRoot.findElement

  Schedule a command to find a descendant of this ShadowROot. If the element cannot be found, the returned promise will be rejected with a {@linkplain error.NoSuchElementError NoSuchElementError}.

  The search criteria for an element may be defined using one of the static factories on the {@link by.By} class, or as a short-hand {@link ./by.ByHash} object. For example, the following two statements are equivalent:

      var e1 = shadowroot.findElement(By.id('foo'));
      var e2 = shadowroot.findElement({id:'foo'});

  You may also provide a custom locator function, which takes as input this instance and returns a WebElement, or a promise that will resolve to a WebElement. If the returned promise resolves to an array of WebElements, WebDriver will use the first element. For example, to find the first visible link on a page, you could write:

      var link = element.findElement(firstVisibleLink);

      function firstVisibleLink(shadowRoot) {
        var links = shadowRoot.findElements(By.tagName('a'));
        return promise.filter(links, function(link) {
          return link.isDisplayed();
        });
      }

  #### Parameters

  - ##### locator: Locator

    The locator strategy to use when searching for the element.

  #### Returns WebElementPromise

  A WebElement that can be used to issue commands against the located element. If the element is not found, the element will be invalidated and all scheduled commands aborted.

### findElements

- findElements(locator: Locator): Promise<WebElement[]>

- Inherited from ShadowRoot.findElements

  Locates all of the descendants of this element that match the given search criteria.

  #### Parameters

  - ##### locator: Locator

    The locator strategy to use when searching for the element.

  #### Returns Promise<WebElement[]>

  A promise that will resolve to an array of WebElements.

### getId

- getId(): Promise<string>

- Inherited from ShadowRoot.getId

  #### Returns Promise<string>

### serialize

- serialize(): Promise<IWebElementId>

- Inherited from ShadowRoot.serialize

  override

  #### Returns Promise<IWebElementId>

### then

- then<TResult1, TResult2>(onfulfilled?: (value: ShadowRoot) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>

- Inherited from Promise.then

  Attaches callbacks for the resolution and/or rejection of the Promise.

  #### Type parameters

  - #### TResult1 = ShadowRoot

  - #### TResult2 = never

  #### Parameters

  - ##### Optional onfulfilled: (value: ShadowRoot) => TResult1 | PromiseLike<TResult1>

    The callback to execute when the Promise is resolved.

    - - (value: ShadowRoot): TResult1 | PromiseLike<TResult1>

      - #### Parameters

        - ##### value: ShadowRoot

        #### Returns TResult1 | PromiseLike<TResult1>

  - ##### Optional onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>

    The callback to execute when the Promise is rejected.

    - - (reason: any): TResult2 | PromiseLike<TResult2>

      - #### Parameters

        - ##### reason: any

        #### Returns TResult2 | PromiseLike<TResult2>

  #### Returns Promise<TResult1 | TResult2>

  A Promise for the completion of which ever callback is executed.

### Static extractId

- extractId(obj: any): string

- Inherited from ShadowRoot.extractId

  Extracts the encoded ShadowRoot ID from the object.

  throws

    {TypeError} if the object is not a valid encoded ID.

  #### Parameters

  - ##### obj: any

    The object to extract the ID from.

  #### Returns string

  the extracted ID.

### Static isId

- isId(obj: any): boolean

- Inherited from ShadowRoot.isId

  #### Parameters

  - ##### obj: any

    the object to test.

  #### Returns boolean

  whether the object is a valid encoded WebElement ID.

Generated using TypeDoc