File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,20 +76,20 @@ export async function getDomProperty(
7676 return stringResponse ( JSON . stringify ( content ) , 'Property received successfully.' ) ;
7777}
7878
79- async function getTextContentProperty ( element : ElementHandle < Node > ) : Promise < string > {
79+ async function getTextContent ( element : ElementHandle < Node > ) : Promise < string > {
8080 const tag = await ( await element . getProperty ( 'tagName' ) ) . jsonValue ( ) ;
8181 if ( tag === 'INPUT' || tag === 'TEXTAREA' ) {
82- return 'value' ;
82+ return await ( await element . getProperty ( 'value' ) ) . jsonValue ( ) ;
8383 }
84- return ' innerText' ;
84+ return await element . innerText ( ) ;
8585}
8686
8787export async function getText ( request : Request . ElementSelector , state : PlaywrightState ) : Promise < Response . String > {
8888 const selector = request . getSelector ( ) ;
8989 const element = await waitUntilElementExists ( state , selector ) ;
9090 let content : string ;
9191 try {
92- content = await ( await element . getProperty ( await getTextContentProperty ( element ) ) ) . jsonValue ( ) ;
92+ content = await getTextContent ( element ) ;
9393 logger . info ( `Retrieved text for element ${ selector } containing ${ content } ` ) ;
9494 } catch ( e ) {
9595 logger . error ( e ) ;
You can’t perform that action at this time.
0 commit comments