import { ElementHandle } from 'playwright' ; export async function getInnerTextOfHandle ( selector ) { if ( ! selector ) { return null ; } const result = await selector . evaluate ( ( el ) : string => { const inputElement = el as HTMLElement ; return inputElement && inputElement . innerText ; } ) ; if ( typeof result === 'string' ) { return result . replace ( /\s/g , ' ' ) ; } return result ; }