Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

19.2 KB
Raw Blame
# 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.

Frame:
  type: interface

  initializer:
    url: string
    name: string
    parentFrame: Frame?
    loadStates:
      type: array
      items: LifecycleEvent

  commands:

    evalOnSelector:
      title: Evaluate
      subtitle: '{selector}'
      parameters:
        selector: string
        strict: boolean?
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue
      flags:
        snapshot: true
        pause: true

    evalOnSelectorAll:
      title: Evaluate
      subtitle: '{selector}'
      parameters:
        selector: string
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue
      flags:
        snapshot: true
        pause: true

    addScriptTag:
      title: Add script tag
      renderParams:
      - url
      parameters:
        url: string?
        content: string?
        type: string?
      returns:
        element: ElementHandle
      flags:
        snapshot: true
        pause: true

    addStyleTag:
      title: Add style tag
      renderParams:
      - url
      parameters:
        url: string?
        content: string?
      returns:
        element: ElementHandle
      flags:
        snapshot: true
        pause: true

    ariaSnapshot:
      title: Aria snapshot
      subtitle: '{selector}'
      group: getter
      parameters:
        mode:
          type: enum?
          literals:
            - ai
            - default
        selector: string?
        depth: int?
        boxes: boolean?
      returns:
        snapshot: string

    ariaSnapshotJSON:
      title: Aria snapshot JSON
      subtitle: '{selector}'
      group: getter
      parameters:
        mode:
          type: enum?
          literals:
            - ai
            - default
        selector: string?
        depth: int?
        boxes: boolean?
      returns:
        snapshot: json

    blur:
      title: Blur
      subtitle: '{selector}'
      parameters:
        selector: string
        strict: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true

    check:
      title: Check
      subtitle: '{selector}'
      renderParams:
      - position
      parameters:
        selector: string
        strict: boolean?
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        position: Point?
        trial: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    click:
      title: Click
      subtitle: '{selector}'
      renderParams:
      - button
      - clickCount
      - modifiers
      - position
      parameters:
        selector: string
        strict: boolean?
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        noWaitAfter: boolean?
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - ControlOrMeta
            - Meta
            - Shift
        position: Point?
        delay: float?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        clickCount: int?
        trial: boolean?
        steps: int?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    content:
      title: Get content
      parameters:
        includeShadow: boolean?
      returns:
        value: string
      flags:
        snapshot: true
        pause: true

    dragAndDrop:
      title: Drag and drop
      renderParams:
      - source:selector
      - target:selector
      parameters:
        source: string
        target: string
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        trial: boolean?
        sourcePosition: Point?
        targetPosition: Point?
        strict: boolean?
        steps: int?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    drop:
      title: Drop files or data onto an element
      subtitle: '{selector}'
      parameters:
        selector: string
        strict: boolean?
        position: Point?
        # Only one of payloads, localPaths and streams may be present.
        payloads:
          type: array?
          items:
            type: object
            properties:
              name: string
              mimeType: string?
              buffer: binary
        localPaths:
          type: array?
          items: string
        streams:
          type: array?
          items: WritableStream
        data:
          type: array?
          items:
            type: object
            properties:
              mimeType: string
              value: string
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    dblclick:
      title: Double click
      subtitle: '{selector}'
      renderParams:
      - button
      - modifiers
      - position
      parameters:
        selector: string
        strict: boolean?
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - ControlOrMeta
            - Meta
            - Shift
        position: Point?
        delay: float?
        button:
          type: enum?
          literals:
          - left
          - right
          - middle
        trial: boolean?
        steps: int?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    dispatchEvent:
      title: Dispatch "{type}"
      subtitle: '{selector}'
      renderParams:
      - type
      parameters:
        selector: string
        strict: boolean?
        type: string
        eventInit: SerializedArgument
      flags:
        slowMo: true
        snapshot: true
        pause: true

    evaluateExpression:
      title: Evaluate
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        value: SerializedValue
      flags:
        snapshot: true
        pause: true

    evaluateExpressionHandle:
      title: Evaluate
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
      returns:
        handle: JSHandle
      flags:
        snapshot: true
        pause: true

    fill:
      title: Fill "{value}"
      subtitle: '{selector}'
      renderParams:
      - value
      parameters:
        selector: string
        strict: boolean?
        value: string
        force: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    focus:
      title: Focus
      subtitle: '{selector}'
      parameters:
        selector: string
        strict: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true

    frameElement:
      title: Get frame element
      group: getter
      returns:
        element: ElementHandle

    resolveSelector:
      internal: true
      parameters:
        selector: string
        sdkLanguage: SDKLanguage?
      returns:
        resolvedSelector: string
        locatorCode: string?

    highlight:
      internal: true
      parameters:
        selector: string
        style: string?

    hideHighlight:
      internal: true
      parameters:
        selector: string

    getAttribute:
      title: Get attribute "{name}"
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
        name: string
      returns:
        value: string?
      flags:
        snapshot: true
        pause: true

    goto:
      title: Navigate
      subtitle: '{url}'
      renderParams:
      - url
      parameters:
        url: string
        waitUntil: LifecycleEvent?
        referer: string?
      returns:
        response: Response?
      flags:
        slowMo: true
        snapshot: true
        pause: true

    hover:
      title: Hover
      subtitle: '{selector}'
      renderParams:
      - modifiers
      - position
      parameters:
        selector: string
        strict: boolean?
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - ControlOrMeta
            - Meta
            - Shift
        position: Point?
        trial: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    innerHTML:
      title: Get HTML
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: string
      flags:
        snapshot: true
        pause: true

    innerText:
      title: Get inner text
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: string
      flags:
        snapshot: true
        pause: true

    inputValue:
      title: Get input value
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: string
      flags:
        snapshot: true
        pause: true

    isChecked:
      title: Is checked
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: boolean
      flags:
        snapshot: true
        pause: true

    isDisabled:
      title: Is disabled
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: boolean
      flags:
        snapshot: true
        pause: true

    isEnabled:
      title: Is enabled
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: boolean
      flags:
        snapshot: true
        pause: true

    isHidden:
      title: Is hidden
      subtitle: '{selector}'
      group: getter
      parameters:
        # Note: compared to other isFoo methods, isHidden is a one-shot operation without a timeout.
        selector: string
        strict: boolean?
      returns:
        value: boolean
      flags:
        snapshot: true
        pause: true

    isVisible:
      title: Is visible
      subtitle: '{selector}'
      group: getter
      parameters:
        # Note: compared to other isFoo methods, isVisible is a one-shot operation without a timeout.
        selector: string
        strict: boolean?
      returns:
        value: boolean
      flags:
        snapshot: true
        pause: true

    isEditable:
      title: Is editable
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: boolean
      flags:
        snapshot: true
        pause: true

    press:
      title: Press "{key}"
      subtitle: '{selector}'
      renderParams:
      - key
      parameters:
        selector: string
        strict: boolean?
        key: string
        delay: float?
        noWaitAfter: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    querySelector:
      title: Query selector
      subtitle: '{selector}'
      parameters:
        selector: string
        strict: boolean?
      returns:
        element: ElementHandle?
      flags:
        snapshot: true

    querySelectorAll:
      title: Query selector all
      subtitle: '{selector}'
      parameters:
        selector: string
      returns:
        elements:
          type: array
          items: ElementHandle
      flags:
        snapshot: true

    queryCount:
      title: Query count
      subtitle: '{selector}'
      parameters:
        selector: string
      returns:
        value: int
      flags:
        snapshot: true
        pause: true

    selectOption:
      title: Select option
      subtitle: '{selector}'
      renderParams:
      - options
      parameters:
        selector: string
        strict: boolean?
        elements:
          type: array?
          items: ElementHandle
        options:
          type: array?
          items:
            type: object
            properties:
              valueOrLabel: string?
              value: string?
              label: string?
              index: int?
        force: boolean?
      returns:
        values:
          type: array
          items: string
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    setContent:
      title: Set content
      parameters:
        html: string
        waitUntil: LifecycleEvent?
      flags:
        snapshot: true
        pause: true

    setInputFiles:
      title: Set input files
      subtitle: '{selector}'
      renderParams:
      - files=localPaths
      parameters:
        selector: string
        strict: boolean?
        # Only one of payloads, localPaths and streams should be present.
        payloads:
          type: array?
          items:
            type: object
            properties:
              name: string
              mimeType: string?
              buffer: binary
        localDirectory: string?
        directoryStream: WritableStream?
        localPaths:
          type: array?
          items: string
        streams:
          type: array?
          items: WritableStream
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    tap:
      title: Tap
      subtitle: '{selector}'
      renderParams:
      - modifiers
      - position
      parameters:
        selector: string
        strict: boolean?
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        modifiers:
          type: array?
          items:
            type: enum
            literals:
            - Alt
            - Control
            - ControlOrMeta
            - Meta
            - Shift
        position: Point?
        trial: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    textContent:
      title: Get text content
      subtitle: '{selector}'
      group: getter
      parameters:
        selector: string
        strict: boolean?
      returns:
        value: string?
      flags:
        snapshot: true
        pause: true

    title:
      title: Get page title
      group: getter
      returns:
        value: string

    type:
      title: Type "{text}"
      subtitle: '{selector}'
      renderParams:
      - text
      parameters:
        selector: string
        strict: boolean?
        text: string
        delay: float?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    uncheck:
      title: Uncheck
      subtitle: '{selector}'
      renderParams:
      - position
      parameters:
        selector: string
        strict: boolean?
        force: boolean?
        scroll:
          type: enum?
          literals:
          - auto
          - none
        position: Point?
        trial: boolean?
      flags:
        slowMo: true
        snapshot: true
        pause: true
        input: true
        isAutoWaiting: true

    waitForTimeout:
      title: Wait for timeout
      renderParams:
      - timeout=waitTimeout
      parameters:
        waitTimeout: float
      flags:
        snapshot: true

    waitForFunction:
      title: Wait for function
      subtitle: '{selector}'
      parameters:
        expression: string
        isFunction: boolean?
        arg: SerializedArgument
        # When present, polls on interval. Otherwise, polls on raf.
        pollingInterval: float?
        # When present, first argument is the matched element.
        selector: string?
        strict: boolean?
      returns:
        # Missing when "selector" is present.
        handle: JSHandle?
      flags:
        snapshot: true
        pause: true

    waitForSelector:
      title: Wait for selector
      subtitle: '{selector}'
      renderParams:
      - state
      parameters:
        selector: string
        strict: boolean?
        state:
          type: enum?
          literals:
          - attached
          - detached
          - visible
          - hidden
        omitReturnValue: boolean?
      returns:
        element: ElementHandle?
      flags:
        snapshot: true

    expect:
      title: Expect "{expression}"
      subtitle: '{selector}'
      parameters:
        selector: string?
        expression: string
        expressionArg: json?
        pseudo:
          type: enum?
          literals:
          - before
          - after
        expectedText:
          type: array?
          items: ExpectedTextValue
        expectedNumber: float?
        expectedValue: SerializedArgument?
        useInnerText: boolean?
        isNot: boolean
      errorDetails:
        received:
          type: object?
          properties:
            value: SerializedValue?
            ariaSnapshot: string?
        timedOut: boolean?
        customErrorMessage: string?
      flags:
        snapshot: true
        pause: true

    webmcpTools:
      title: List WebMCP tools
      group: getter
      returns:
        tools:
          type: array
          items:
            type: object
            properties:
              name: string
              description: string
              inputSchema: json?
              annotations:
                type: object?
                properties:
                  readOnly: boolean?
                  untrustedContent: boolean?
                  consequential: boolean?

    webmcpCallTool:
      title: Call WebMCP tool
      parameters:
        name: string
        input: SerializedArgument
      returns:
        result: SerializedValue

  events:

    loadstate:
      parameters:
        add: LifecycleEvent?
        remove: LifecycleEvent?

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