# Copyright (c) Microsoft Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

StackFrame:
  type: object
  properties:
    file: string
    line: number?
    column: number?
    function: string?

# This object can be send with any rpc call in the "metadata" field.

Metadata:
  type: object
  properties:
    stack:
      type: array?
      items: StackFrame
    apiName: string?


WaitForEventInfo:
  type: object
  properties:
    waitId: string
    phase:
      type: enum
      literals:
      - before
      - after
      - log
    name: string?
    stack:
      type: array?
      items: StackFrame
    message: string?
    error: string?


Point:
  type: object
  properties:
    x: number
    y: number


Rect:
  type: object
  properties:
    x: number
    y: number
    width: number
    height: number


SerializedValue:
  type: object
  # Exactly one of the properties must be present.
  properties:
    n: number?
    b: boolean?
    s: string?
    v:
      type: enum?
      literals:
      - null
      - undefined
      - NaN
      - Infinity
      - -Infinity
      - "-0"
    # String representation of the Date.
    d: string?
    # Regular expression pattern and flags.
    r:
      type: object?
      properties:
        p: string
        f: string
    a:
      type: array?
      items: SerializedValue
    # Object with keys and values.
    o:
      type: array?
      items:
        type: object
        properties:
          k: string
          v: SerializedValue
    # An index in the handles array from SerializedArgument.
    h: number?


# Represents a value with handle references.
SerializedArgument:
  type: object
  properties:
    value: SerializedValue
    handles:
      type: array
      items: Channel


AXNode:
  type: object
  properties:
    role: string
    name: string
    valueString: string?
    valueNumber: number?
    description: string?
    keyshortcuts: string?
    roledescription: string?
    valuetext: string?
    disabled: boolean?
    expanded: boolean?
    focused: boolean?
    modal: boolean?
    multiline: boolean?
    multiselectable: boolean?
    readonly: boolean?
    required: boolean?
    selected: boolean?
    checked:
      type: enum?
      literals:
      - checked
      - unchecked
      - mixed
    pressed:
      type: enum?
      literals:
      - pressed
      - released
      - mixed
    level: number?
    valuemin: number?
    valuemax: number?
    autocomplete: string?
    haspopup: string?
    invalid: string?
    orientation: string?
    children:
      type: array?
      items: AXNode


SetNetworkCookie:
  type: object
  properties:
    name: string
    value: string
    url: string?
    domain: string?
    path: string?
    expires: number?
    httpOnly: boolean?
    secure: boolean?
    sameSite:
      type: enum?
      literals:
      - Strict
      - Lax
      - None


NetworkCookie:
  type: object
  properties:
    name: string
    value: string
    domain: string
    path: string
    expires: number
    httpOnly: boolean
    secure: boolean
    sameSite:
      type: enum
      literals:
      - Strict
      - Lax
      - None


NameValue:
  type: object
  properties:
    name: string
    value: string


OriginStorage:
  type: object
  properties:
    origin: string
    localStorage:
      type: array
      items: NameValue


SerializedError:
  type: object
  properties:
    error:
      type: object?
      properties:
        message: string
        name: string
        stack: string?
    value: SerializedValue?


Playwright:
  type: interface

  initializer:
    chromium: BrowserType
    firefox: BrowserType
    webkit: BrowserType
    android: Android
    electron: Electron
    deviceDescriptors:
      type: array
      items:
        type: object
        properties:
          name: string
          descriptor:
            type: object
            properties:
              userAgent: string
              viewport:
                type: object
                properties:
                  width: number
                  height: number
              deviceScaleFactor: number
              isMobile: boolean
              hasTouch: boolean
              defaultBrowserType:
                type: enum
                literals:
                - chromium
                - firefox
                - webkit
    selectors: Selectors


RemoteBrowser:
  type: interface

  initializer:
    browser: Browser
    selectors: Selectors

  events:

    # Video stream blocks owner context from closing until the stream is closed.
    # Make sure to close the stream!
    video:
      parameters:
        context: BrowserContext
        stream: Stream
        relativePath: string


Selectors:
  type: interface

  commands:

    register:
      parameters:
        name: string
        source: string
        contentScript: boolean?


BrowserType:
  type: interface

  initializer:
    executablePath: string
    name: string

  commands:

    launch:
      parameters:
        executablePath: string?
        args:
          type: array?
          items: string
        ignoreAllDefaultArgs: boolean?
        ignoreDefaultArgs:
          type: array?
          items: string
        handleSIGINT: boolean?
        handleSIGTERM: boolean?
        handleSIGHUP: boolean?
        timeout: number?
        env:
          type: array?
          items: NameValue
        headless: boolean?
        devtools: boolean?
        proxy:
          type: object?
          properties:
            server: string
            bypass: string?
            username: string?
            password: string?
        downloadsPath: string?
        firefoxUserPrefs: json?
        chromiumSandbox: boolean?
        slowMo: number?
      returns:
        browser: Browser

    launchPersistentContext:
      parameters:
        userDataDir: string
        sdkLanguage: string
        executablePath: string?
        args:
          type: array?
          items: string
        ignoreAllDefaultArgs: boolean?
        ignoreDefaultArgs:
          type: array?
          items: string
        handleSIGINT: boolean?
        handleSIGTERM: boolean?
        handleSIGHUP: boolean?
        timeout: number?
        env:
          type: array?
          items: NameValue
        headless: boolean?
        devtools: boolean?
        proxy:
          type: object?
          properties:
            server: string
            bypass: string?
            username: string?
            password: string?
        downloadsPath: string?
        chromiumSandbox: boolean?
        slowMo: number?
        noDefaultViewport: boolean?
        viewport:
          type: object?
          properties:
            width: number
            height: number
        ignoreHTTPSErrors: boolean?
        javaScriptEnabled: boolean?
        bypassCSP: boolean?
        userAgent: string?
        locale: string?
        timezoneId: string?
        geolocation:
          type: object?
          properties:
            longitude: number
            latitude: number
            accuracy: number?
        permissions:
          type: array?
          items: string
        extraHTTPHeaders:
          type: array?
          items: NameValue
        offline: boolean?
        httpCredentials:
          type: object?
          properties:
            username: string
            password: string
        deviceScaleFactor: number?
        isMobile: boolean?
        hasTouch: boolean?
        colorScheme:
          type: enum?
          literals:
          - light
          - dark
          - no-preference
        acceptDownloads: boolean?
        _traceDir: string?
        _debugName: string?
        recordVideo:
          type: object?
          properties:
            dir: string
            size:
              type: object?
              properties:
                width: number
                height: number
        recordHar:
          type: object?
          properties:
            omitContent: boolean?
            path: string
      returns:
        context: BrowserContext

    connectOverCDP:
      parameters:
        sdkLanguage: string
        wsEndpoint: string
        slowMo: number?
        timeout: number?
      returns:
        browser: Browser
        defaultContext: BrowserContext?

Browser:
  type: interface

  initializer:
    version: string
    name: string

  commands:

    close:

    newContext:
      parameters:
        sdkLanguage: string
        noDefaultViewport: boolean?
        viewport:
          type: object?
          properties:
            width: number
            height: number
        ignoreHTTPSErrors: boolean?
        javaScriptEnabled: boolean?
        bypassCSP: boolean?
        userAgent: string?
        locale: string?
        timezoneId: string?
        geolocation:
          type: object?
          properties:
            longitude: number
            latitude: number
            accuracy: number?
        permissions:
          type: array?
          items: string
        extraHTTPHeaders:
          type: array?
          items: NameValue
        offline: boolean?
        httpCredentials:
          type: object?
          properties:
            username: string
            password: string
        deviceScaleFactor: number?
        isMobile: boolean?
        hasTouch: boolean?
        colorScheme:
          type: enum?
          literals:
          - dark
          - light
          - no-preference
        acceptDownloads: boolean?
        _traceDir: string?
        _debugName: string?
        recordVideo:
          type: object?
          properties:
            dir: string
            size:
              type: object?
              properties:
                width: number
                height: number
        recordHar:
          type: object?
          properties:
            omitContent: boolean?
            path: string
        proxy:
          type: object?
          properties:
            server: string
            bypass: string?
            username: string?
            password: string?
        storageState:
          type: object?
          properties:
            cookies:
              type: array?
              items: SetNetworkCookie
            origins:
              type: array?
              items: OriginStorage
      returns:
        context: BrowserContext

    crNewBrowserCDPSession:
      returns:
        session: CDPSession

    crStartTracing:
      parameters:
        page: Page?
        path: string?
        screenshots: boolean?
        categories:
          type: array?
          items: string

    crStopTracing:
      returns:
        binary: binary

  events:

    close:



BrowserContext:
  type: interface

  initializer:
    isChromium: boolean

  commands:

    addCookies:
      parameters:
        cookies:
          type: array
          items: SetNetworkCookie

    addInitScript:
      parameters:
        source: string

    clearCookies:

    clearPermissions:

    close:

    cookies:
      parameters:
        urls:
          type: array
          items: string
      returns:
        cookies:
          type: array
          items: NetworkCookie

    exposeBinding:
      parameters:
        name: string
        needsHandle: boolean?

    grantPermissions:
      parameters:
        permissions:
          type: array
          items: string
        origin: string?

    newPage:
      returns:
        page: Page

    setDefaultNavigationTimeoutNoReply:
      parameters:
        timeout: number

    setDefaultTimeoutNoReply:
      parameters:
        timeout: number

    setExtraHTTPHeaders:
      parameters:
        headers:
          type: array
          items: NameValue

    setGeolocation:
      parameters:
        geolocation:
          type: object?
          properties:
            longitude: number
            latitude: number
            accuracy: number?

    setHTTPCredentials:
      parameters:
        httpCredentials:
          type: object?
          properties:
            username: string
            password: string

    setNetworkInterceptionEnabled:
      parameters:
        enabled: boolean

    setOffline:
      parameters:
        offline: boolean

    storageState:
      returns:
        cookies:
          type: array
          items: NetworkCookie
        origins:
          type: array
          items: OriginStorage

    pause:
      experimental: True

    recorderSupplementEnable:
      experimental: True
      parameters:
        language: string?
        startRecording: boolean?
        pauseOnNextStatement: boolean?
        launchOptions: json?
        contextOptions: json?
        device: string?
        saveStorage: string?
        outputFile: string?

    crNewCDPSession:
      parameters:
        page: Page
      returns:
        session: CDPSession

  events:

    bindingCall:
      parameters:
        binding: BindingCall

    close:

    page:
      parameters:
        page: Page

    route:
      parameters:
        route: Route
        request: Request

    crBackgroundPage:
      parameters:
        page: Page

    crServiceWorker:
      parameters:
        worker: Worker

Page:
  type: interface

  initializer:
    mainFrame: Frame
    viewportSize:
      type: object?
      properties:
        width: number
        height: number
    isClosed: boolean
    videoRelativePath: string?

  commands:

    setDefaultNavigationTimeoutNoReply:
      parameters:
        timeout: number

    setDefaultTimeoutNoReply:
      parameters:
        timeout: number

    setFileChooserInterceptedNoReply:
      parameters:
        intercepted: boolean

    addInitScript:
      parameters:
        source: string

    close:
      parameters:
        runBeforeUnload: boolean?

    emulateMedia:
      parameters:
        media:
          type: enum?
          literals:
          - screen
          - print
          # Reset emulated value to the system default.
          - null
        colorScheme:
          type: enum?
          literals:
          - dark
          - light
          - no-preference
          # Reset emulated value to the system default.
          - null

    exposeBinding:
      parameters:
        name: string
        needsHandle: boolean?

    goBack:
      parameters:
        timeout: number?
        waitUntil:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle
      returns:
        response: Response?

    goForward:
      parameters:
        timeout: number?
        waitUntil:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle
      returns:
        response: Response?

    opener:
      returns:
        page: Page?

    reload:
      parameters:
        timeout: number?
        waitUntil:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle
      returns:
        response: Response?

    screenshot:
      parameters:
        timeout: number?
        type:
          type: enum?
          literals:
          - png
          - jpeg
        quality: number?
        omitBackground: boolean?
        fullPage: boolean?
        clip: Rect?
      returns:
        binary: binary

    setExtraHTTPHeaders:
      parameters:
        headers:
          type: array
          items: NameValue

    setNetworkInterceptionEnabled:
      parameters:
        enabled: boolean

    setViewportSize:
      parameters:
        viewportSize:
          type: object
          properties:
            width: number
            height: number

    keyboardDown:
      parameters:
        key: string

    keyboardUp:
      parameters:
        key: string

    keyboardInsertText:
      parameters:
        text: string

    keyboardType:
      parameters:
        text: string
        delay: number?

    keyboardPress:
      parameters:
        key: string
        delay: number?

    mouseMove:
      parameters:
        x: number
        y: number
        steps: number?

    mouseDown:
      parameters:
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        clickCount: number?

    mouseUp:
      parameters:
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        clickCount: number?

    mouseClick:
      parameters:
        x: number
        y: number
        delay: number?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        clickCount: number?

    touchscreenTap:
      parameters:
        x: number
        y: number

    accessibilitySnapshot:
      parameters:
        interestingOnly: boolean?
        root: ElementHandle?
      returns:
        rootAXNode: AXNode?

    pdf:
      parameters:
        scale: number?
        displayHeaderFooter: boolean?
        headerTemplate: string?
        footerTemplate: string?
        printBackground: boolean?
        landscape: boolean?
        pageRanges: string?
        format: string?
        width: string?
        height: string?
        preferCSSPageSize: boolean?
        margin:
          type: object?
          properties:
            top: string?
            bottom: string?
            left: string?
            right: string?
      returns:
        pdf: binary

    crStartJSCoverage:
      parameters:
        resetOnNavigation: boolean?
        reportAnonymousScripts: boolean?

    crStopJSCoverage:
      returns:
        entries:
          type: array
          items:
            type: object
            properties:
              url: string
              scriptId: string
              source: string?
              functions:
                type: array
                items:
                  type: object
                  properties:
                    functionName: string
                    isBlockCoverage: boolean
                    ranges:
                      type: array
                      items:
                        type: object
                        properties:
                          startOffset: number
                          endOffset: number
                          count: number

    crStartCSSCoverage:
      parameters:
        resetOnNavigation: boolean?

    crStopCSSCoverage:
      returns:
        entries:
          type: array
          items:
            type: object
            properties:
              url: string
              text: string?
              ranges:
                type: array
                items:
                  type: object
                  properties:
                    start: number
                    end: number

    bringToFront:

  events:

    bindingCall:
      parameters:
        binding: BindingCall

    close:

    console:
      parameters:
        message: ConsoleMessage

    crash:

    dialog:
      parameters:
        dialog: Dialog

    download:
      parameters:
        download: Download

    domcontentloaded:

    fileChooser:
      parameters:
        element: ElementHandle
        isMultiple: boolean

    frameAttached:
      parameters:
        frame: Frame

    frameDetached:
      parameters:
        frame: Frame

    load:

    pageError:
      parameters:
        error: SerializedError

    popup:
      parameters:
        page: Page

    request:
      parameters:
        request: Request

    requestFailed:
      parameters:
        request: Request
        failureText: string?
        responseEndTiming: number

    requestFinished:
      parameters:
        request: Request
        responseEndTiming: number

    response:
      parameters:
        response: Response

    route:
      parameters:
        route: Route
        request: Request

    video:
      parameters:
        relativePath: string

    webSocket:
      parameters:
        webSocket: WebSocket

    worker:
      parameters:
        worker: Worker



Frame:
  type: interface

  initializer:
    url: string
    name: string
    parentFrame: Frame?
    loadStates:
      type: array
      items:
        type: enum
        literals:
        - load
        - domcontentloaded
        - networkidle

  commands:

    evalOnSelector:
      parameters:
        selector: string
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    evalOnSelectorAll:
      parameters:
        selector: string
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    addScriptTag:
      parameters:
        url: string?
        content: string?
        type: string?
      returns:
        element: ElementHandle

    addStyleTag:
      parameters:
        url: string?
        content: string?
      returns:
        element: ElementHandle

    check:
      parameters:
        selector: string
        force: boolean?
        noWaitAfter: boolean?
        timeout: number?

    click:
      parameters:
        selector: string
        force: boolean?
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        delay: number?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        clickCount: number?
        timeout: number?

    content:
      returns:
        value: string

    dblclick:
      parameters:
        selector: string
        force: boolean?
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        delay: number?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        timeout: number?

    dispatchEvent:
      parameters:
        selector: string
        type: string
        eventInit: SerializedArgument
        timeout: number?

    evaluateExpression:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
        world:
          type: enum?
          literals:
          - main
          - utility
      returns:
        value: SerializedValue

    evaluateExpressionHandle:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
        world:
          type: enum?
          literals:
          - main
          - utility
      returns:
        handle: JSHandle

    fill:
      parameters:
        selector: string
        value: string
        timeout: number?
        noWaitAfter: boolean?

    focus:
      parameters:
        selector: string
        timeout: number?

    frameElement:
      returns:
        element: ElementHandle

    getAttribute:
      parameters:
        selector: string
        name: string
        timeout: number?
      returns:
        value: string?

    goto:
      parameters:
        url: string
        timeout: number?
        waitUntil:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle
        referer: string?
      returns:
        response: Response?

    hover:
      parameters:
        selector: string
        force: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        timeout: number?

    innerHTML:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: string

    innerText:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: string

    isChecked:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: boolean

    isDisabled:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: boolean

    isEnabled:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: boolean

    isHidden:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: boolean

    isVisible:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: boolean

    isEditable:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: boolean

    press:
      parameters:
        selector: string
        key: string
        delay: number?
        noWaitAfter: boolean?
        timeout: number?

    querySelector:
      parameters:
        selector: string
      returns:
        element: ElementHandle?

    querySelectorAll:
      parameters:
        selector: string
      returns:
        elements:
          type: array
          items: ElementHandle

    selectOption:
      parameters:
        selector: string
        elements:
          type: array?
          items: ElementHandle
        options:
          type: array?
          items:
            type: object
            properties:
              value: string?
              label: string?
              index: number?
        timeout: number?
        noWaitAfter: boolean?
      returns:
        values:
          type: array
          items: string

    setContent:
      parameters:
        html: string
        timeout: number?
        waitUntil:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle

    setInputFiles:
      parameters:
        selector: string
        files:
          type: array
          items:
            type: object
            properties:
              name: string
              mimeType: string
              buffer: binary
        timeout: number?
        noWaitAfter: boolean?

    tap:
      parameters:
        selector: string
        force: boolean?
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        timeout: number?

    textContent:
      parameters:
        selector: string
        timeout: number?
      returns:
        value: string?

    title:
      returns:
        value: string

    type:
      parameters:
        selector: string
        text: string
        delay: number?
        noWaitAfter: boolean?
        timeout: number?

    uncheck:
      parameters:
        selector: string
        force: boolean?
        noWaitAfter: boolean?
        timeout: number?

    waitForFunction:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
        timeout: number?
        # When present, polls on interval. Otherwise, polls on raf.
        pollingInterval: number?
      returns:
        handle: JSHandle

    waitForSelector:
      parameters:
        selector: string
        timeout: number?
        state:
          type: enum?
          literals:
          - attached
          - detached
          - visible
          - hidden
      returns:
        element: ElementHandle?

  events:

    loadstate:
      parameters:
        add:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle
        remove:
          type: enum?
          literals:
          - load
          - domcontentloaded
          - networkidle

    navigated:
      parameters:
        url: string
        name: string
        newDocument:
          type: object?
          properties:
            request: Request?
        error: string?



Worker:
  type: interface

  initializer:
    url: string

  commands:

    evaluateExpression:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    evaluateExpressionHandle:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        handle: JSHandle

  events:

    close:


JSHandle:
  type: interface

  initializer:
    preview: string

  commands:

    dispose:

    evaluateExpression:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    evaluateExpressionHandle:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        handle: JSHandle

    getPropertyList:
      returns:
        properties:
          type: array
          items:
            type: object
            properties:
              name: string
              value: JSHandle

    getProperty:
      parameters:
        name: string
      returns:
        handle: JSHandle

    jsonValue:
      returns:
        value: SerializedValue

  events:

    previewUpdated:
      parameters:
        preview: string



ElementHandle:
  type: interface

  extends: JSHandle

  commands:

    evalOnSelector:
      parameters:
        selector: string
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    evalOnSelectorAll:
      parameters:
        selector: string
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    boundingBox:
      returns:
        value: Rect?

    check:
      parameters:
        force: boolean?
        noWaitAfter: boolean?
        timeout: number?

    click:
      parameters:
        force: boolean?
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        delay: number?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        clickCount: number?
        timeout: number?

    contentFrame:
      returns:
        frame: Frame?

    dblclick:
      parameters:
        force: boolean?
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        delay: number?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        timeout: number?

    dispatchEvent:
      parameters:
        type: string
        eventInit: SerializedArgument

    fill:
      parameters:
        value: string
        timeout: number?
        noWaitAfter: boolean?

    focus:

    getAttribute:
      parameters:
        name: string
      returns:
        value: string?

    hover:
      parameters:
        force: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        timeout: number?

    innerHTML:
      returns:
        value: string

    innerText:
      returns:
        value: string

    isChecked:
      returns:
        value: boolean

    isDisabled:
      returns:
        value: boolean

    isEditable:
      returns:
        value: boolean

    isEnabled:
      returns:
        value: boolean

    isHidden:
      returns:
        value: boolean

    isVisible:
      returns:
        value: boolean

    ownerFrame:
      returns:
        frame: Frame?

    press:
      parameters:
        key: string
        delay: number?
        timeout: number?
        noWaitAfter: boolean?

    querySelector:
      parameters:
        selector: string
      returns:
        element: ElementHandle?

    querySelectorAll:
      parameters:
        selector: string
      returns:
        elements:
          type: array
          items: ElementHandle

    screenshot:
      parameters:
        timeout: number?
        type:
          type: enum?
          literals:
          - png
          - jpeg
        quality: number?
        omitBackground: boolean?
      returns:
        binary: binary

    scrollIntoViewIfNeeded:
      parameters:
        timeout: number?

    selectOption:
      parameters:
        elements:
          type: array?
          items: ElementHandle
        options:
          type: array?
          items:
            type: object
            properties:
              value: string?
              label: string?
              index: number?
        timeout: number?
        noWaitAfter: boolean?
      returns:
        values:
          type: array
          items: string

    selectText:
      parameters:
        timeout: number?

    setInputFiles:
      parameters:
        files:
          type: array
          items:
            type: object
            properties:
              name: string
              mimeType: string
              buffer: binary
        timeout: number?
        noWaitAfter: boolean?

    tap:
      parameters:
        force: boolean?
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - Meta
            - Shift
        position: Point?
        timeout: number?

    textContent:
      returns:
        value: string?

    type:
      parameters:
        text: string
        delay: number?
        noWaitAfter: boolean?
        timeout: number?

    uncheck:
      parameters:
        force: boolean?
        noWaitAfter: boolean?
        timeout: number?

    waitForElementState:
      parameters:
        state:
          type: enum
          literals:
          - visible
          - hidden
          - stable
          - enabled
          - disabled
          - editable
        timeout: number?

    waitForSelector:
      parameters:
        selector: string
        timeout: number?
        state:
          type: enum?
          literals:
          - attached
          - detached
          - visible
          - hidden
      returns:
        element: ElementHandle?


Request:
  type: interface

  initializer:
    frame: Frame
    url: string
    resourceType: string
    method: string
    postData: binary?
    headers:
      type: array
      items:
        type: object
        properties:
          name: string
          value: string
    isNavigationRequest: boolean
    redirectedFrom: Request?

  commands:

    response:
      returns:
        response: Response?



Route:
  type: interface

  initializer:
    request: Request

  commands:

    abort:
      parameters:
        errorCode: string?

    continue:
      parameters:
        url: string?
        method: string?
        headers:
          type: array?
          items: NameValue
        postData: binary?

    fulfill:
      parameters:
        # default is 200
        status: number?
        headers:
          type: array?
          items: NameValue
        body: string?
        isBase64: boolean?


ResourceTiming:
  type: object
  properties:
    startTime: number
    domainLookupStart: number
    domainLookupEnd: number
    connectStart: number
    secureConnectionStart: number
    connectEnd: number
    requestStart: number
    responseStart: number

Response:
  type: interface

  initializer:
    request: Request
    url: string
    status: number
    statusText: string
    requestHeaders:
      type: array
      items:
        type: object
        properties:
          name: string
          value: string
    headers:
      type: array
      items:
        type: object
        properties:
          name: string
          value: string
    timing: ResourceTiming


  commands:

    body:
      returns:
        binary: binary

    finished:
      returns:
        error: string?


WebSocket:
  type: interface

  initializer:
    url: string

  events:
    open:

    frameSent:
      parameters:
        opcode: number
        data: string

    frameReceived:
      parameters:
        opcode: number
        data: string

    socketError:
      parameters:
        error: string

    close:


ConsoleMessage:
  type: interface

  initializer:
    type: string
    text: string
    args:
      type: array
      items: JSHandle
    location:
      type: object
      properties:
        url: string
        lineNumber: number
        columnNumber: number



BindingCall:
  type: interface

  initializer:
    frame: Frame
    name: string
    args:
      type: array?
      items: SerializedValue
    handle: JSHandle?

  commands:

    reject:
      parameters:
        error: SerializedError

    resolve:
      parameters:
        result: SerializedArgument



Dialog:
  type: interface

  initializer:
    type: string
    message: string
    defaultValue: string

  commands:

    accept:
      parameters:
        promptText: string?

    dismiss:



Download:
  type: interface

  initializer:
    url: string
    suggestedFilename: string

  commands:

    path:
      returns:
        value: string?

    # Blocks path/failure/delete/context.close until saved to the local |path|.
    saveAs:
      parameters:
        path: string

    # Blocks path/failure/delete/context.close until the stream is closed.
    saveAsStream:
      returns:
        stream: Stream

    failure:
      returns:
        error: string?

    stream:
      returns:
        stream: Stream?

    delete:



Stream:
  type: interface

  commands:

    read:
      parameters:
        size: number?
      returns:
        binary: binary

    close:


CDPSession:
  type: interface

  commands:

    send:
      parameters:
        method: string
        params: json?
      returns:
        result: json

    detach:

  events:

    event:
      parameters:
        method: string
        params: json?


Electron:
  type: interface

  commands:

    launch:
      parameters:
        sdkLanguage: string
        executablePath: string?
        args:
          type: array?
          items: string
        cwd: string?
        env:
          type: array?
          items: NameValue
        timeout: number?
      returns:
        electronApplication: ElectronApplication


ElectronApplication:
  type: interface

  commands:

    evaluateExpression:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue

    evaluateExpressionHandle:
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        handle: JSHandle

    close:

  events:

    # This event happens once immediately after creation.
    context:
      parameters:
        context: BrowserContext

    close:

    window:
      parameters:
        page: Page
        browserWindow: JSHandle



Android:
  type: interface

  commands:

    devices:
      returns:
        devices:
          type: array
          items: AndroidDevice

    setDefaultTimeoutNoReply:
      parameters:
        timeout: number

AndroidSocket:
  type: interface

  commands:
    write:
      parameters:
        data: binary

    close:

  events:
    data:
      parameters:
        data: binary
    close:

AndroidDevice:
  type: interface

  initializer:
    model: string
    serial: string

  commands:
    wait:
      parameters:
        selector: AndroidSelector
        state:
          type: enum?
          literals:
          - gone
        timeout: number?

    fill:
      parameters:
        selector: AndroidSelector
        text: string
        timeout: number?

    tap:
      parameters:
        selector: AndroidSelector
        duration: number?
        timeout: number?

    drag:
      parameters:
        selector: AndroidSelector
        dest: Point
        speed: number?
        timeout: number?

    fling:
      parameters:
        selector: AndroidSelector
        direction:
          type: enum
          literals:
          - up
          - down
          - left
          - right
        speed: number?
        timeout: number?

    longTap:
      parameters:
        selector: AndroidSelector
        timeout: number?

    pinchClose:
      parameters:
        selector: AndroidSelector
        percent: number
        speed: number?
        timeout: number?

    pinchOpen:
      parameters:
        selector: AndroidSelector
        percent: number
        speed: number?
        timeout: number?

    scroll:
      parameters:
        selector: AndroidSelector
        direction:
          type: enum
          literals:
          - up
          - down
          - left
          - right
        percent: number
        speed: number?
        timeout: number?

    swipe:
      parameters:
        selector: AndroidSelector
        direction:
          type: enum
          literals:
          - up
          - down
          - left
          - right
        percent: number
        speed: number?
        timeout: number?

    info:
      parameters:
        selector: AndroidSelector
      returns:
        info: AndroidElementInfo

    screenshot:
      returns:
        binary: binary

    inputType:
      parameters:
        text: string

    inputPress:
      parameters:
        key: string

    inputTap:
      parameters:
        point: Point

    inputSwipe:
      parameters:
        segments:
          type: array
          items: Point
        steps: number

    inputDrag:
      parameters:
        from: Point
        to: Point
        steps: number

    launchBrowser:
      parameters:
        sdkLanguage: string
        pkg: string?
        ignoreHTTPSErrors: boolean?
        javaScriptEnabled: boolean?
        bypassCSP: boolean?
        userAgent: string?
        locale: string?
        timezoneId: string?
        geolocation:
          type: object?
          properties:
            longitude: number
            latitude: number
            accuracy: number?
        permissions:
          type: array?
          items: string
        extraHTTPHeaders:
          type: array?
          items: NameValue
        offline: boolean?
        httpCredentials:
          type: object?
          properties:
            username: string
            password: string
        deviceScaleFactor: number?
        isMobile: boolean?
        hasTouch: boolean?
        colorScheme:
          type: enum?
          literals:
          - dark
          - light
          - no-preference
        acceptDownloads: boolean?
        _traceDir: string?
        _debugName: string?
        recordVideo:
          type: object?
          properties:
            dir: string
            size:
              type: object?
              properties:
                width: number
                height: number
        recordHar:
          type: object?
          properties:
            omitContent: boolean?
            path: string
        proxy:
          type: object?
          properties:
            server: string
            bypass: string?
            username: string?
            password: string?

      returns:
        context: BrowserContext

    open:
      parameters:
        command: string
      returns:
        socket: AndroidSocket

    shell:
      parameters:
        command: string
      returns:
        result: binary

    installApk:
      parameters:
        file: binary
        args:
          type: array?
          items: string

    push:
      parameters:
        file: binary
        path: string
        mode: number?

    setDefaultTimeoutNoReply:
      parameters:
        timeout: number

    connectToWebView:
      parameters:
        sdkLanguage: string
        pid: number
      returns:
        context: BrowserContext

    close:

  events:
    webViewAdded:
      parameters:
        webView: AndroidWebView

    webViewRemoved:
      parameters:
        pid: number


AndroidWebView:
  type: object
  properties:
    pid: number
    pkg: string


AndroidSelector:
  type: object
  properties:
    checkable: boolean?
    checked: boolean?
    clazz: string?
    clickable: boolean?
    depth: number?
    desc: string?
    enabled: boolean?
    focusable: boolean?
    focused: boolean?
    hasChild:
      type: object?
      properties:
        selector: AndroidSelector
    hasDescendant:
      type: object?
      properties:
        selector: AndroidSelector
        maxDepth: number?
    longClickable: boolean?
    pkg: string?
    res: string?
    scrollable: boolean?
    selected: boolean?
    text: string?


AndroidElementInfo:
  type: object
  properties:
    children:
      type: array?
      items: AndroidElementInfo
    clazz: string
    desc: string
    res: string
    pkg: string
    text: string
    bounds: Rect
    checkable: boolean
    checked: boolean
    clickable: boolean
    enabled: boolean
    focusable: boolean
    focused: boolean
    longClickable: boolean
    scrollable: boolean
    selected: boolean
