MCPcopy Create free account
hub / github.com/gotify/server / clickByText

Function clickByText

ui/src/tests/utils.ts:11–25  ·  view source on GitHub ↗
(page: Page, selector: string, text: string)

Source from the content-addressed store, hash-verified

9};
10
11export const clickByText = async (page: Page, selector: string, text: string): Promise<void> => {
12 await waitForExists(page, selector, text);
13 text = text.toLowerCase();
14 await page.evaluate(
15 (_selector, _text) => {
16 (
17 Array.from(document.querySelectorAll(_selector)).filter(
18 (element) => element.textContent?.toLowerCase().trim() === _text
19 )[0] as HTMLButtonElement
20 ).click();
21 },
22 selector,
23 text
24 );
25};
26
27export const count = async (page: Page, selector: string): Promise<number> =>
28 page.$$(selector).then((elements) => elements.length);

Callers 1

navigateFunction · 0.90

Calls 1

waitForExistsFunction · 0.85

Tested by 1

navigateFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…