fix: if page closed !get child selectors

This commit is contained in:
Karishma Shukla
2025-08-21 20:37:01 +05:30
committed by GitHub
parent 6fa4f88dee
commit 1eea6290da

View File

@@ -2753,6 +2753,10 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates
export const getChildSelectors = async (page: Page, parentSelector: string): Promise<string[]> => {
try {
if (page.isClosed()) {
logger.debug('Page is closed, cannot get child selectors');
return [];
}
const childSelectors = await page.evaluate((parentSelector: string) => {
// Function to get a non-unique selector based on tag and class (if present)
function getNonUniqueSelector(element: HTMLElement): string {