Skip to content

Commit

Permalink
feat: implement UnableToCaptureScreenException in browsingContext.c…
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiago Perrotta authored Sep 1, 2023
1 parent faf97f2 commit 8110918
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
10 changes: 9 additions & 1 deletion src/bidiMapper/domains/context/BrowsingContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,19 @@ export class BrowsingContextImpl {

rect = rect ? getIntersectionRect(rect, viewport) : viewport;

if (rect.width === 0 || rect.height === 0) {
throw new UnableToCaptureScreenException(
`Unable to capture screenshot with zero dimensions: width=${rect.width}, height=${rect.height}`
);
}

const result = await this.#cdpTarget.cdpClient.sendCommand(
'Page.captureScreenshot',
{clip: {...rect, scale: 1.0}}
);
return {data: result.data};
return {
data: result.data,
};
}

async print(
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 8110918

Please sign in to comment.