File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -76,20 +76,20 @@ export async function getDomProperty(
76
76
return stringResponse ( JSON . stringify ( content ) , 'Property received successfully.' ) ;
77
77
}
78
78
79
- async function getTextContentProperty ( element : ElementHandle < Node > ) : Promise < string > {
79
+ async function getTextContent ( element : ElementHandle < Node > ) : Promise < string > {
80
80
const tag = await ( await element . getProperty ( 'tagName' ) ) . jsonValue ( ) ;
81
81
if ( tag === 'INPUT' || tag === 'TEXTAREA' ) {
82
- return 'value' ;
82
+ return await ( await element . getProperty ( 'value' ) ) . jsonValue ( ) ;
83
83
}
84
- return ' innerText' ;
84
+ return await element . innerText ( ) ;
85
85
}
86
86
87
87
export async function getText ( request : Request . ElementSelector , state : PlaywrightState ) : Promise < Response . String > {
88
88
const selector = request . getSelector ( ) ;
89
89
const element = await waitUntilElementExists ( state , selector ) ;
90
90
let content : string ;
91
91
try {
92
- content = await ( await element . getProperty ( await getTextContentProperty ( element ) ) ) . jsonValue ( ) ;
92
+ content = await getTextContent ( element ) ;
93
93
logger . info ( `Retrieved text for element ${ selector } containing ${ content } ` ) ;
94
94
} catch ( e ) {
95
95
logger . error ( e ) ;
You can’t perform that action at this time.
0 commit comments