I'm working on a typescript protractor skeleton and I would like to add a new click, and sendkeys method that are improved than the original ones, here is what I have come up with for the improved click():
import {browser, by, ElementArrayFinder, ElementFinder, ExpectedConditions, Key} from 'protractor';
const actionTimeout = 5000;
ElementFinder.prototype.secureClick = function () {
return browser
.wait(ExpectedConditions.elementToBeClickable(this), actionTimeout)
.then(() => browser.executeScript('arguments[0].scrollIntoView();', this.getWebElement()))
.then(() => this.click())
.catch(err => {
throw new Error(`Expected ElementFinder ${this.locator()} to be clickable. ${err.toString()}`);
});
};
Now the problem starts when i want to import this document:
import './secureClick'
export async function myFun() {
await somelocator.secureClick()
}
error msg: .secureClick() is not a function