import { ElementHandle } from 'playwright' ; export async function getClassListOfHandle ( selector ) { if ( ! selector ) { return [ ] ; } const stringifiedClassList = await selector . evaluate ( ( el ) : string => { const classList = Array . from ( el . classList ) ; return JSON . stringify ( classList ) ; } ) ; const classList = JSON . parse ( stringifiedClassList ) ; if ( ! Array . isArray ( classList ) ) { return [ ] ; } return classList ; }