UNPKG

tlc-core-automation-framework-v3-wdio-v9

Version:

Background: - We are following multi-layer automation framework architecture using webdriver.io + cucumber + typescript This core framework has been implemented with generic utility functions and cucumber steps, which can be easily consumed by another fra

13 lines (11 loc) 739 B
import {PageConfigTypes} from "../../../custom-types/pageConfig-types"; import logger from "../../reporting-helpers/logger"; import waitForElementStateByIndex from "./waitForElementStateByIndex"; import {browser, $, $$, expect} from '@wdio/globals' export default async function (elementPosition: number = 0, pageConfig: PageConfigTypes, elementState: string = "Displayed") { const index = elementPosition - 1; await waitForElementStateByIndex(elementPosition, pageConfig, false, elementState, 15, 1000) let elementsByIndex = await $$(pageConfig.selector)[index] await elementsByIndex.click(); logger.info(`Clicked the "${pageConfig.pageId}.${pageConfig.elementKey}" element found at ${elementPosition} position.`); }