puppeteer: Fix get_element_text including hidden text.

Previously, this function used the `textContent` property, which
includes hidden elements. Fix this by using innerText instead.
This commit is contained in:
evykassirer 2022-06-01 19:50:51 -07:00 committed by Tim Abbott
parent 67771f80d0
commit 72166f1b03
1 changed files with 1 additions and 1 deletions

View File

@ -192,7 +192,7 @@ class CommonUtils {
} }
async get_element_text(element: ElementHandle<Element>): Promise<string> { async get_element_text(element: ElementHandle<Element>): Promise<string> {
return (await element.getProperty("textContent"))!.jsonValue(); return (await element.getProperty("innerText"))!.jsonValue();
} }
async get_text_from_selector(page: Page, selector: string): Promise<string> { async get_text_from_selector(page: Page, selector: string): Promise<string> {