Skip to content

Commit 6a218d5

Browse files
authored
use innerText / fixes problem detected in a Salesforce web component - that I can not reproduce (#1001)
1 parent fb937d8 commit 6a218d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

node/playwright-wrapper/getters.ts

+4-4
Original file line numberDiff line numberDiff 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

8787
export 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);

0 commit comments

Comments
 (0)