fix: if page closed !get element selector
This commit is contained in:
@@ -1092,6 +1092,10 @@ export const getRect = async (page: Page, coordinates: Coordinates, listSelector
|
|||||||
*/
|
*/
|
||||||
export const getSelectors = async (page: Page, coordinates: Coordinates) => {
|
export const getSelectors = async (page: Page, coordinates: Coordinates) => {
|
||||||
try {
|
try {
|
||||||
|
if (page.isClosed()) {
|
||||||
|
logger.debug('Page is closed, cannot get selectors');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const selectors: any = await page.evaluate(async ({ x, y }) => {
|
const selectors: any = await page.evaluate(async ({ x, y }) => {
|
||||||
// version @medv/finder
|
// version @medv/finder
|
||||||
// https://github.com/antonmedv/finder/blob/master/finder.ts
|
// https://github.com/antonmedv/finder/blob/master/finder.ts
|
||||||
|
|||||||
Reference in New Issue
Block a user