MCPcopy Create free account
hub / github.com/krausest/js-framework-benchmark / clickElementByXPath

Function clickElementByXPath

webdriver-ts/src/webdriverAccess.ts:245–254  ·  view source on GitHub ↗
(driver: WebDriver, xpath: string, isInButtonArea: boolean)

Source from the content-addressed store, hash-verified

243}
244
245export async function clickElementByXPath(driver: WebDriver, xpath: string, isInButtonArea: boolean) {
246 return await retry(5, driver, async function (driver, count) {
247 if (count > 1 && config.LOG_DETAILS) console.log("clickElementByXPath", xpath, "attempt #", count);
248 let elem = await findByXPath(driver, xpath, isInButtonArea);
249 if (!elem) throw new Error(`Element with xpath ${xpath} not found`);
250 await elem.click();
251 });
252 // Stale element possible:
253 // return to(driver.findElement(By.xpath(xpath)).click());
254}
255
256export async function getTextByXPath(driver: WebDriver, xpath: string, isInButtonArea: boolean): Promise<string> {
257 return await retry(5, driver, async function (driver, count) {

Callers 4

initMethod · 0.70
runMethod · 0.70
runMethod · 0.70
initMethod · 0.70

Calls 2

retryFunction · 0.70
findByXPathFunction · 0.70

Tested by

no test coverage detected