playwright#Frame TypeScript Examples
The following examples show how to use
playwright#Frame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: does-not-exist.ts From playwright-fluent with MIT License | 6 votes |
export async function doesNotExist(
selector: string,
page: Page | Frame | undefined,
): Promise<boolean> {
if (!page) {
throw new Error(
`Cannot check that '${selector}' does not exist because no browser has been launched`,
);
}
try {
const result = await page.$(selector);
if (result === null) {
return true;
}
return false;
} catch (error) {
// eslint-disable-next-line no-console
console.warn(
`An internal error has occured in Playwright API while checking if selector '${selector}' does not exist.`,
error,
);
return true;
}
}