Open kyleect opened 4 years ago
async findElement<T extends WebElement>( by: By, WebElementClass?: Constructor<T> ): Promise<T> { const elementId = await this.driver.findElement(by); if (typeof elementId === "undefined") { throw new ElementNotFoundError( `Unable to find element using ${by.using}: ${by.value}` ); } const WebElementImplementation: Constructor<T> = (WebElementClass || WebElement) as any; // TODO: This is, admittedly, a hack const element: T = new WebElementImplementation(this, by, elementId); return element; }