mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	feat(rpc): remove some union types (#3058)
This commit is contained in:
		
							parent
							
								
									5848ed8f41
								
							
						
					
					
						commit
						2d59a8f9c2
					
				| @ -45,16 +45,11 @@ export type SerializedArgument = { | |||||||
|   handles: Channel[], |   handles: Channel[], | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export type AXNodeValue = string | number; |  | ||||||
| 
 |  | ||||||
| export type AXNodeChecked = boolean | 'mixed'; |  | ||||||
| 
 |  | ||||||
| export type AXNodePressed = boolean | 'mixed'; |  | ||||||
| 
 |  | ||||||
| export type AXNode = { | export type AXNode = { | ||||||
|   role: string, |   role: string, | ||||||
|   name: string, |   name: string, | ||||||
|   value?: AXNodeValue, |   valueString?: string, | ||||||
|  |   valueNumber?: number, | ||||||
|   description?: string, |   description?: string, | ||||||
|   keyshortcuts?: string, |   keyshortcuts?: string, | ||||||
|   roledescription?: string, |   roledescription?: string, | ||||||
| @ -68,8 +63,8 @@ export type AXNode = { | |||||||
|   readonly?: boolean, |   readonly?: boolean, | ||||||
|   required?: boolean, |   required?: boolean, | ||||||
|   selected?: boolean, |   selected?: boolean, | ||||||
|   checked?: AXNodeChecked, |   checked?: 'checked' | 'unchecked' | 'mixed', | ||||||
|   pressed?: AXNodePressed, |   pressed?: 'pressed' | 'released' | 'mixed', | ||||||
|   level?: number, |   level?: number, | ||||||
|   valuemin?: number, |   valuemin?: number, | ||||||
|   valuemax?: number, |   valuemax?: number, | ||||||
| @ -80,15 +75,6 @@ export type AXNode = { | |||||||
|   children?: AXNode[], |   children?: AXNode[], | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export type WaitForFunctionPolling = number | 'raf'; |  | ||||||
| 
 |  | ||||||
| export type Viewport = { |  | ||||||
|   width: number, |  | ||||||
|   height: number, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| export type ViewportOrNull = null | Viewport; |  | ||||||
| 
 |  | ||||||
| export type SerializedError = { | export type SerializedError = { | ||||||
|   error?: { |   error?: { | ||||||
|     message: string, |     message: string, | ||||||
| @ -241,7 +227,11 @@ export type BrowserTypeLaunchPersistentContextParams = { | |||||||
|   }, |   }, | ||||||
|   downloadsPath?: string, |   downloadsPath?: string, | ||||||
|   slowMo?: number, |   slowMo?: number, | ||||||
|   viewport?: ViewportOrNull, |   noDefaultViewport?: boolean, | ||||||
|  |   viewport?: { | ||||||
|  |     width: number, | ||||||
|  |     height: number, | ||||||
|  |   }, | ||||||
|   ignoreHTTPSErrors?: boolean, |   ignoreHTTPSErrors?: boolean, | ||||||
|   javaScriptEnabled?: boolean, |   javaScriptEnabled?: boolean, | ||||||
|   bypassCSP?: boolean, |   bypassCSP?: boolean, | ||||||
| @ -303,7 +293,11 @@ export type BrowserCloseEvent = {}; | |||||||
| export type BrowserCloseParams = {}; | export type BrowserCloseParams = {}; | ||||||
| export type BrowserCloseResult = void; | export type BrowserCloseResult = void; | ||||||
| export type BrowserNewContextParams = { | export type BrowserNewContextParams = { | ||||||
|   viewport?: ViewportOrNull, |   noDefaultViewport?: boolean, | ||||||
|  |   viewport?: { | ||||||
|  |     width: number, | ||||||
|  |     height: number, | ||||||
|  |   }, | ||||||
|   ignoreHTTPSErrors?: boolean, |   ignoreHTTPSErrors?: boolean, | ||||||
|   javaScriptEnabled?: boolean, |   javaScriptEnabled?: boolean, | ||||||
|   bypassCSP?: boolean, |   bypassCSP?: boolean, | ||||||
| @ -1094,7 +1088,7 @@ export type FrameWaitForFunctionParams = { | |||||||
|   isFunction: boolean, |   isFunction: boolean, | ||||||
|   arg: SerializedArgument, |   arg: SerializedArgument, | ||||||
|   timeout?: number, |   timeout?: number, | ||||||
|   polling?: WaitForFunctionPolling, |   pollingInterval?: number, | ||||||
| }; | }; | ||||||
| export type FrameWaitForFunctionResult = { | export type FrameWaitForFunctionResult = { | ||||||
|   handle: JSHandleChannel, |   handle: JSHandleChannel, | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ | |||||||
| import { PageChannel } from '../channels'; | import { PageChannel } from '../channels'; | ||||||
| import { ElementHandle } from './elementHandle'; | import { ElementHandle } from './elementHandle'; | ||||||
| import * as types from '../../types'; | import * as types from '../../types'; | ||||||
|  | import { axNodeFromProtocol } from '../serializers'; | ||||||
| 
 | 
 | ||||||
| export class Accessibility { | export class Accessibility { | ||||||
|   private _channel: PageChannel; |   private _channel: PageChannel; | ||||||
| @ -29,6 +30,6 @@ export class Accessibility { | |||||||
|   async snapshot(options: { interestingOnly?: boolean; root?: ElementHandle } = {}): Promise<types.SerializedAXNode | null> { |   async snapshot(options: { interestingOnly?: boolean; root?: ElementHandle } = {}): Promise<types.SerializedAXNode | null> { | ||||||
|     const root = options.root ? options.root._elementChannel : undefined; |     const root = options.root ? options.root._elementChannel : undefined; | ||||||
|     const result = await this._channel.accessibilitySnapshot({ interestingOnly: options.interestingOnly, root }); |     const result = await this._channel.accessibilitySnapshot({ interestingOnly: options.interestingOnly, root }); | ||||||
|     return result.rootAXNode || null; |     return result.rootAXNode ? axNodeFromProtocol(result.rootAXNode) : null; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -57,6 +57,8 @@ export class Browser extends ChannelOwner<BrowserChannel, BrowserInitializer> { | |||||||
|     return this._wrapApiCall('browser.newContext', async () => { |     return this._wrapApiCall('browser.newContext', async () => { | ||||||
|       const contextOptions: BrowserNewContextParams = { |       const contextOptions: BrowserNewContextParams = { | ||||||
|         ...options, |         ...options, | ||||||
|  |         viewport: options.viewport === null ? undefined : options.viewport, | ||||||
|  |         noDefaultViewport: options.viewport === null, | ||||||
|         extraHTTPHeaders: options.extraHTTPHeaders ? headersObjectToArray(options.extraHTTPHeaders) : undefined, |         extraHTTPHeaders: options.extraHTTPHeaders ? headersObjectToArray(options.extraHTTPHeaders) : undefined, | ||||||
|       }; |       }; | ||||||
|       const context = BrowserContext.from((await this._channel.newContext(contextOptions)).context); |       const context = BrowserContext.from((await this._channel.newContext(contextOptions)).context); | ||||||
|  | |||||||
| @ -77,6 +77,8 @@ export class BrowserType extends ChannelOwner<BrowserTypeChannel, BrowserTypeIni | |||||||
|     return this._wrapApiCall('browserType.launchPersistentContext', async () => { |     return this._wrapApiCall('browserType.launchPersistentContext', async () => { | ||||||
|       const persistentOptions: BrowserTypeLaunchPersistentContextParams = { |       const persistentOptions: BrowserTypeLaunchPersistentContextParams = { | ||||||
|         ...options, |         ...options, | ||||||
|  |         viewport: options.viewport === null ? undefined : options.viewport, | ||||||
|  |         noDefaultViewport: options.viewport === null, | ||||||
|         ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined, |         ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined, | ||||||
|         ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs), |         ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs), | ||||||
|         env: options.env ? envObjectToArray(options.env) : undefined, |         env: options.env ? envObjectToArray(options.env) : undefined, | ||||||
|  | |||||||
| @ -380,7 +380,13 @@ export class Frame extends ChannelOwner<FrameChannel, FrameInitializer> { | |||||||
|   async waitForFunction<R>(pageFunction: Func1<void, R>, arg?: any, options?: types.WaitForFunctionOptions): Promise<SmartHandle<R>>; |   async waitForFunction<R>(pageFunction: Func1<void, R>, arg?: any, options?: types.WaitForFunctionOptions): Promise<SmartHandle<R>>; | ||||||
|   async waitForFunction<R, Arg>(pageFunction: Func1<Arg, R>, arg: Arg, options: types.WaitForFunctionOptions = {}): Promise<SmartHandle<R>> { |   async waitForFunction<R, Arg>(pageFunction: Func1<Arg, R>, arg: Arg, options: types.WaitForFunctionOptions = {}): Promise<SmartHandle<R>> { | ||||||
|     return this._wrapApiCall(this._apiName('waitForFunction'), async () => { |     return this._wrapApiCall(this._apiName('waitForFunction'), async () => { | ||||||
|       const result = await this._channel.waitForFunction({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg), ...options }); |       const result = await this._channel.waitForFunction({ | ||||||
|  |         ...options, | ||||||
|  |         pollingInterval: options.polling === 'raf' ? undefined : options.polling, | ||||||
|  |         expression: String(pageFunction), | ||||||
|  |         isFunction: typeof pageFunction === 'function', | ||||||
|  |         arg: serializeArgument(arg), | ||||||
|  |       }); | ||||||
|       return JSHandle.from(result.handle) as SmartHandle<R>; |       return JSHandle.from(result.handle) as SmartHandle<R>; | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -41,24 +41,11 @@ type SerializedArgument | |||||||
|   value: SerializedValue |   value: SerializedValue | ||||||
|   handles: Channel[] |   handles: Channel[] | ||||||
| 
 | 
 | ||||||
| union AXNodeValue |  | ||||||
|   string |  | ||||||
|   number |  | ||||||
| 
 |  | ||||||
| union AXNodeChecked |  | ||||||
|   boolean |  | ||||||
|   enum |  | ||||||
|     mixed |  | ||||||
| 
 |  | ||||||
| union AXNodePressed |  | ||||||
|   boolean |  | ||||||
|   enum |  | ||||||
|     mixed |  | ||||||
| 
 |  | ||||||
| type AXNode | type AXNode | ||||||
|   role: string |   role: string | ||||||
|   name: string |   name: string | ||||||
|   value?: AXNodeValue |   valueString?: string | ||||||
|  |   valueNumber?: number | ||||||
|   description?: string |   description?: string | ||||||
|   keyshortcuts?: string |   keyshortcuts?: string | ||||||
|   roledescription?: string |   roledescription?: string | ||||||
| @ -72,8 +59,14 @@ type AXNode | |||||||
|   readonly?: boolean |   readonly?: boolean | ||||||
|   required?: boolean |   required?: boolean | ||||||
|   selected?: boolean |   selected?: boolean | ||||||
|   checked?: AXNodeChecked |   checked?: enum | ||||||
|   pressed?: AXNodePressed |     checked | ||||||
|  |     unchecked | ||||||
|  |     mixed | ||||||
|  |   pressed?: enum | ||||||
|  |     pressed | ||||||
|  |     released | ||||||
|  |     mixed | ||||||
|   level?: number |   level?: number | ||||||
|   valuemin?: number |   valuemin?: number | ||||||
|   valuemax?: number |   valuemax?: number | ||||||
| @ -83,19 +76,6 @@ type AXNode | |||||||
|   orientation?: string |   orientation?: string | ||||||
|   children?: AXNode[] |   children?: AXNode[] | ||||||
| 
 | 
 | ||||||
| union WaitForFunctionPolling |  | ||||||
|   number |  | ||||||
|   enum |  | ||||||
|     raf |  | ||||||
| 
 |  | ||||||
| type Viewport |  | ||||||
|   width: number |  | ||||||
|   height: number |  | ||||||
| 
 |  | ||||||
| union ViewportOrNull |  | ||||||
|   null |  | ||||||
|   Viewport |  | ||||||
| 
 |  | ||||||
| type SerializedError | type SerializedError | ||||||
|   error?: object |   error?: object | ||||||
|     message: string |     message: string | ||||||
| @ -222,7 +202,10 @@ interface BrowserType | |||||||
|         password?: string |         password?: string | ||||||
|       downloadsPath?: string |       downloadsPath?: string | ||||||
|       slowMo?: number |       slowMo?: number | ||||||
|       viewport?: ViewportOrNull |       noDefaultViewport?: boolean | ||||||
|  |       viewport?: object | ||||||
|  |         width: number | ||||||
|  |         height: number | ||||||
|       ignoreHTTPSErrors?: boolean |       ignoreHTTPSErrors?: boolean | ||||||
|       javaScriptEnabled?: boolean |       javaScriptEnabled?: boolean | ||||||
|       bypassCSP?: boolean |       bypassCSP?: boolean | ||||||
| @ -270,7 +253,10 @@ interface Browser | |||||||
| 
 | 
 | ||||||
|   command newContext |   command newContext | ||||||
|     parameters |     parameters | ||||||
|       viewport?: ViewportOrNull |       noDefaultViewport?: boolean | ||||||
|  |       viewport?: object | ||||||
|  |         width: number | ||||||
|  |         height: number | ||||||
|       ignoreHTTPSErrors?: boolean |       ignoreHTTPSErrors?: boolean | ||||||
|       javaScriptEnabled?: boolean |       javaScriptEnabled?: boolean | ||||||
|       bypassCSP?: boolean |       bypassCSP?: boolean | ||||||
| @ -1016,7 +1002,8 @@ interface Frame | |||||||
|       isFunction: boolean |       isFunction: boolean | ||||||
|       arg: SerializedArgument |       arg: SerializedArgument | ||||||
|       timeout?: number |       timeout?: number | ||||||
|       polling?: WaitForFunctionPolling |       # When present, polls on interval. Otherwise, polls on raf. | ||||||
|  |       pollingInterval?: number | ||||||
|     returns |     returns | ||||||
|       handle: JSHandle |       handle: JSHandle | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ import * as util from 'util'; | |||||||
| import { TimeoutError } from '../errors'; | import { TimeoutError } from '../errors'; | ||||||
| import * as types from '../types'; | import * as types from '../types'; | ||||||
| import { helper, assert } from '../helper'; | import { helper, assert } from '../helper'; | ||||||
| import { SerializedError } from './channels'; | import { SerializedError, AXNode } from './channels'; | ||||||
| import { serializeAsCallArgument, parseEvaluationResultValue } from '../common/utilityScriptSerializers'; | import { serializeAsCallArgument, parseEvaluationResultValue } from '../common/utilityScriptSerializers'; | ||||||
| 
 | 
 | ||||||
| export function serializeError(e: any): SerializedError { | export function serializeError(e: any): SerializedError { | ||||||
| @ -143,3 +143,29 @@ export function envArrayToObject(env: types.EnvArray): types.Env { | |||||||
|     result[name] = value; |     result[name] = value; | ||||||
|   return result; |   return result; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | export function axNodeToProtocol(axNode: types.SerializedAXNode): AXNode { | ||||||
|  |   const result: AXNode = { | ||||||
|  |     ...axNode, | ||||||
|  |     valueNumber: typeof axNode.value === 'number' ? axNode.value : undefined, | ||||||
|  |     valueString: typeof axNode.value === 'string' ? axNode.value : undefined, | ||||||
|  |     checked: axNode.checked === true ? 'checked' : axNode.checked === false ? 'unchecked' : axNode.checked, | ||||||
|  |     pressed: axNode.pressed === true ? 'pressed' : axNode.pressed === false ? 'released' : axNode.pressed, | ||||||
|  |     children: axNode.children ? axNode.children.map(axNodeToProtocol) : undefined, | ||||||
|  |   }; | ||||||
|  |   delete (result as any).value; | ||||||
|  |   return result; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export function axNodeFromProtocol(axNode: AXNode): types.SerializedAXNode { | ||||||
|  |   const result: types.SerializedAXNode = { | ||||||
|  |     ...axNode, | ||||||
|  |     value: axNode.valueNumber !== undefined ? axNode.valueNumber : axNode.valueString, | ||||||
|  |     checked: axNode.checked === 'checked' ? true : axNode.checked === 'unchecked' ? false : axNode.checked, | ||||||
|  |     pressed: axNode.pressed === 'pressed' ? true : axNode.pressed === 'released' ? false : axNode.pressed, | ||||||
|  |     children: axNode.children ? axNode.children.map(axNodeFromProtocol) : undefined, | ||||||
|  |   }; | ||||||
|  |   delete (result as any).valueNumber; | ||||||
|  |   delete (result as any).valueString; | ||||||
|  |   return result; | ||||||
|  | } | ||||||
|  | |||||||
| @ -37,6 +37,7 @@ export class BrowserDispatcher extends Dispatcher<Browser, BrowserInitializer> i | |||||||
|   async newContext(params: BrowserNewContextParams): Promise<{ context: BrowserContextChannel }> { |   async newContext(params: BrowserNewContextParams): Promise<{ context: BrowserContextChannel }> { | ||||||
|     const options = { |     const options = { | ||||||
|       ...params, |       ...params, | ||||||
|  |       viewport: params.viewport || (params.noDefaultViewport ? null : undefined), | ||||||
|       extraHTTPHeaders: params.extraHTTPHeaders ? headersArrayToObject(params.extraHTTPHeaders) : undefined, |       extraHTTPHeaders: params.extraHTTPHeaders ? headersArrayToObject(params.extraHTTPHeaders) : undefined, | ||||||
|     }; |     }; | ||||||
|     return { context: new BrowserContextDispatcher(this._scope, await this._object.newContext(options) as BrowserContextBase) }; |     return { context: new BrowserContextDispatcher(this._scope, await this._object.newContext(options) as BrowserContextBase) }; | ||||||
|  | |||||||
| @ -46,6 +46,7 @@ export class BrowserTypeDispatcher extends Dispatcher<BrowserType, BrowserTypeIn | |||||||
|   async launchPersistentContext(params: BrowserTypeLaunchPersistentContextParams): Promise<{ context: BrowserContextChannel }> { |   async launchPersistentContext(params: BrowserTypeLaunchPersistentContextParams): Promise<{ context: BrowserContextChannel }> { | ||||||
|     const options = { |     const options = { | ||||||
|       ...params, |       ...params, | ||||||
|  |       viewport: params.viewport || (params.noDefaultViewport ? null : undefined), | ||||||
|       ignoreDefaultArgs: params.ignoreAllDefaultArgs ? true : params.ignoreDefaultArgs, |       ignoreDefaultArgs: params.ignoreAllDefaultArgs ? true : params.ignoreDefaultArgs, | ||||||
|       env: params.env ? envArrayToObject(params.env) : undefined, |       env: params.env ? envArrayToObject(params.env) : undefined, | ||||||
|       extraHTTPHeaders: params.extraHTTPHeaders ? headersArrayToObject(params.extraHTTPHeaders) : undefined, |       extraHTTPHeaders: params.extraHTTPHeaders ? headersArrayToObject(params.extraHTTPHeaders) : undefined, | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ | |||||||
| 
 | 
 | ||||||
| import { Frame, kAddLifecycleEvent, kRemoveLifecycleEvent, kNavigationEvent, NavigationEvent } from '../../frames'; | import { Frame, kAddLifecycleEvent, kRemoveLifecycleEvent, kNavigationEvent, NavigationEvent } from '../../frames'; | ||||||
| import * as types from '../../types'; | import * as types from '../../types'; | ||||||
| import { ElementHandleChannel, FrameChannel, FrameInitializer, JSHandleChannel, ResponseChannel, SerializedArgument } from '../channels'; | import { ElementHandleChannel, FrameChannel, FrameInitializer, JSHandleChannel, ResponseChannel, SerializedArgument, FrameWaitForFunctionParams } from '../channels'; | ||||||
| import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher'; | import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher'; | ||||||
| import { convertSelectOptionValues, ElementHandleDispatcher, createHandle, convertInputFiles } from './elementHandlerDispatcher'; | import { convertSelectOptionValues, ElementHandleDispatcher, createHandle, convertInputFiles } from './elementHandlerDispatcher'; | ||||||
| import { parseArgument, serializeResult } from './jsHandleDispatcher'; | import { parseArgument, serializeResult } from './jsHandleDispatcher'; | ||||||
| @ -176,8 +176,12 @@ export class FrameDispatcher extends Dispatcher<Frame, FrameInitializer> impleme | |||||||
|     await this._frame.uncheck(params.selector, params); |     await this._frame.uncheck(params.selector, params); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async waitForFunction(params: { expression: string, isFunction: boolean, arg: SerializedArgument } & types.WaitForFunctionOptions): Promise<{ handle: JSHandleChannel }> { |   async waitForFunction(params: FrameWaitForFunctionParams): Promise<{ handle: JSHandleChannel }> { | ||||||
|     return { handle: createHandle(this._scope, await this._frame._waitForFunctionExpression(params.expression, params.isFunction, parseArgument(params.arg), params)) }; |     const options = { | ||||||
|  |       ...params, | ||||||
|  |       polling: params.pollingInterval === undefined ? 'raf' as const : params.pollingInterval | ||||||
|  |     }; | ||||||
|  |     return { handle: createHandle(this._scope, await this._frame._waitForFunctionExpression(params.expression, params.isFunction, parseArgument(params.arg), options)) }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async title(): Promise<{ value: string }> { |   async title(): Promise<{ value: string }> { | ||||||
|  | |||||||
| @ -20,9 +20,9 @@ import { Frame } from '../../frames'; | |||||||
| import { Request } from '../../network'; | import { Request } from '../../network'; | ||||||
| import { Page, Worker } from '../../page'; | import { Page, Worker } from '../../page'; | ||||||
| import * as types from '../../types'; | import * as types from '../../types'; | ||||||
| import { BindingCallChannel, BindingCallInitializer, ElementHandleChannel, PageChannel, PageInitializer, ResponseChannel, WorkerInitializer, WorkerChannel, JSHandleChannel, Binary, SerializedArgument, PagePdfParams, SerializedError } from '../channels'; | import { BindingCallChannel, BindingCallInitializer, ElementHandleChannel, PageChannel, PageInitializer, ResponseChannel, WorkerInitializer, WorkerChannel, JSHandleChannel, Binary, SerializedArgument, PagePdfParams, SerializedError, PageAccessibilitySnapshotResult } from '../channels'; | ||||||
| import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher'; | import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher'; | ||||||
| import { parseError, serializeError, headersArrayToObject } from '../serializers'; | import { parseError, serializeError, headersArrayToObject, axNodeToProtocol } from '../serializers'; | ||||||
| import { ConsoleMessageDispatcher } from './consoleMessageDispatcher'; | import { ConsoleMessageDispatcher } from './consoleMessageDispatcher'; | ||||||
| import { DialogDispatcher } from './dialogDispatcher'; | import { DialogDispatcher } from './dialogDispatcher'; | ||||||
| import { DownloadDispatcher } from './downloadDispatcher'; | import { DownloadDispatcher } from './downloadDispatcher'; | ||||||
| @ -180,12 +180,12 @@ export class PageDispatcher extends Dispatcher<Page, PageInitializer> implements | |||||||
|     await this._page.mouse.click(params.x, params.y, params); |     await this._page.mouse.click(params.x, params.y, params); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async accessibilitySnapshot(params: { interestingOnly?: boolean, root?: ElementHandleChannel }): Promise<{ rootAXNode?: types.SerializedAXNode }> { |   async accessibilitySnapshot(params: { interestingOnly?: boolean, root?: ElementHandleChannel }): Promise<PageAccessibilitySnapshotResult> { | ||||||
|     const rootAXNode = await this._page.accessibility.snapshot({ |     const rootAXNode = await this._page.accessibility.snapshot({ | ||||||
|       interestingOnly: params.interestingOnly, |       interestingOnly: params.interestingOnly, | ||||||
|       root: params.root ? (params.root as ElementHandleDispatcher)._elementHandle : undefined |       root: params.root ? (params.root as ElementHandleDispatcher)._elementHandle : undefined | ||||||
|     }); |     }); | ||||||
|     return { rootAXNode: rootAXNode || undefined }; |     return { rootAXNode: rootAXNode ? axNodeToProtocol(rootAXNode) : undefined }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async pdf(params: PagePdfParams): Promise<{ pdf: Binary }> { |   async pdf(params: PagePdfParams): Promise<{ pdf: Binary }> { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dmitry Gozman
						Dmitry Gozman