Skip to content

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

6.9 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.
 */

// This file is generated by generate_channels.js, do not edit manually.

export type Binary = Buffer;

export interface Channel {
}

export type AndroidWebView = {
  pid: number,
  pkg: string,
  socketName: string,
};

export type AndroidSelector = {
  checkable?: boolean,
  checked?: boolean,
  clazz?: string,
  clickable?: boolean,
  depth?: number,
  desc?: string,
  enabled?: boolean,
  focusable?: boolean,
  focused?: boolean,
  hasChild?: {
    androidSelector: AndroidSelector,
  },
  hasDescendant?: {
    androidSelector: AndroidSelector,
    maxDepth?: number,
  },
  longClickable?: boolean,
  pkg?: string,
  res?: string,
  scrollable?: boolean,
  selected?: boolean,
  text?: string,
};

export type AndroidElementInfo = {
  children?: 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,
};

export type APIResponse = {
  fetchUid: string,
  url: string,
  status: number,
  statusText: string,
  headers: NameValue[],
  securityDetails?: SecurityDetails,
  serverAddr?: RemoteAddr,
  timing?: ResourceTiming,
  responseEndTiming?: number,
};

export type Metadata = {
  location?: {
    file: string,
    line?: number,
    column?: number,
  },
  title?: string,
  internal?: boolean,
  timeout?: number,
};

export type ClientSideCallMetadata = {
  id: string,
  stack?: StackFrame[],
};

export type SDKLanguage = 'javascript' | 'python' | 'java' | 'csharp';

export type WaitInfo = {
  waitId: string,
  phase: 'before' | 'after' | 'log',
  event?: string,
  message?: string,
  error?: string,
};

export type HttpCredentials = {
  username: string,
  password: string,
  origin?: string,
  send?: 'always' | 'unauthorized',
};

export type SetNetworkCookie = {
  name: string,
  value: string,
  url?: string,
  domain?: string,
  path?: string,
  expires?: number,
  httpOnly?: boolean,
  secure?: boolean,
  sameSite?: 'Strict' | 'Lax' | 'None',
  partitionKey?: string,
  _crHasCrossSiteAncestor?: boolean,
};

export type NetworkCookie = {
  name: string,
  value: string,
  domain: string,
  path: string,
  expires: number,
  httpOnly: boolean,
  secure: boolean,
  sameSite: 'Strict' | 'Lax' | 'None',
  partitionKey?: string,
  _crHasCrossSiteAncestor?: boolean,
};

export type ResourceTiming = {
  startTime: number,
  domainLookupStart: number,
  domainLookupEnd: number,
  connectStart: number,
  secureConnectionStart: number,
  connectEnd: number,
  requestStart: number,
  responseStart: number,
};

export type SecurityDetails = {
  issuer?: string,
  protocol?: string,
  subjectName?: string,
  validFrom?: number,
  validTo?: number,
};

export type RequestSizes = {
  requestBodySize: number,
  requestHeadersSize: number,
  responseBodySize: number,
  responseHeadersSize: number,
};

export type RemoteAddr = {
  ipAddress: string,
  port: number,
};

export type ExpectedTextValue = {
  string?: string,
  regexSource?: string,
  regexFlags?: string,
  matchSubstring?: boolean,
  ignoreCase?: boolean,
  normalizeWhiteSpace?: boolean,
};

export type SelectorEngine = {
  name: string,
  source: string,
  contentScript?: boolean,
};

export type FormField = {
  name: string,
  value?: string,
  file?: {
    name: string,
    mimeType?: string,
    buffer: Binary,
  },
};

export type LifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle' | 'commit';

export type ConsoleMessagesFilter = 'all' | 'since-navigation';

export type RecorderSource = {
  isRecorded: boolean,
  id: string,
  label: string,
  text: string,
  language: string,
  highlight: {
    line: number,
    type: string,
  }[],
  revealLine?: number,
  group?: string,
};

export type IndexedDBDatabase = {
  name: string,
  version: number,
  stores: {
    name: string,
    autoIncrement: boolean,
    keyPath?: string,
    keyPathArray?: string[],
    records: {
      key?: any,
      keyEncoded?: any,
      value?: any,
      valueEncoded?: any,
    }[],
    indexes: {
      name: string,
      keyPath?: string,
      keyPathArray?: string[],
      multiEntry: boolean,
      unique: boolean,
    }[],
  }[],
};

export type OPFSEntry = {
  path: string,
  type: 'file' | 'directory',
  base64?: string,
};

export type SetOriginStorage = {
  origin: string,
  localStorage: NameValue[],
  indexedDB?: IndexedDBDatabase[],
  opfs?: OPFSEntry[],
};

export type OriginStorage = {
  origin: string,
  localStorage: NameValue[],
  indexedDB?: IndexedDBDatabase[],
  opfs?: OPFSEntry[],
};

export type RecordHarOptions = {
  content?: 'embed' | 'attach' | 'omit',
  mode?: 'full' | 'minimal',
  urlGlob?: string,
  urlRegexSource?: string,
  urlRegexFlags?: string,
  harPath?: string,
  resourcesDir?: string,
};

export type SerializedValue = {
  n?: number,
  b?: boolean,
  s?: string,
  v?: 'null' | 'undefined' | 'NaN' | 'Infinity' | '-Infinity' | '-0',
  d?: string,
  u?: string,
  bi?: string,
  ta?: {
    b: Binary,
    k: 'i8' | 'ui8' | 'ui8c' | 'i16' | 'ui16' | 'i32' | 'ui32' | 'f32' | 'f64' | 'bi64' | 'bui64',
  },
  e?: {
    m: string,
    n: string,
    s: string,
  },
  r?: {
    p: string,
    f: string,
  },
  a?: SerializedValue[],
  o?: {
    k: string,
    v: SerializedValue,
  }[],
  h?: number,
  fn?: string,
  id?: number,
  ref?: number,
};

export type SerializedArgument = {
  value: SerializedValue,
  handles: Channel[],
};

export type SerializedError = {
  error?: {
    message: string,
    name: string,
    stack?: string,
    code?: string,
  },
  value?: SerializedValue,
};

export type StackFrame = {
  file: string,
  line: number,
  column: number,
  function?: string,
};

export type VirtualCredential = {
  id: string,
  rpId: string,
  userHandle: string,
  privateKey: string,
  publicKey: string,
  signCount: number,
};

export type SetVirtualCredential = {
  id: string,
  rpId: string,
  userHandle: string,
  privateKey: string,
  publicKey: string,
  signCount?: number,
};

export type Point = {
  x: number,
  y: number,
};

export type Rect = {
  x: number,
  y: number,
  width: number,
  height: number,
};

export type URLPattern = {
  hash: string,
  hostname: string,
  password: string,
  pathname: string,
  port: string,
  protocol: string,
  search: string,
  username: string,
};

export type NameValue = {
  name: string,
  value: string,
};