diff --git a/lib/locreator.js b/lib/locreator.js index e4af8ad..5f608dd 100644 --- a/lib/locreator.js +++ b/lib/locreator.js @@ -75,6 +75,11 @@ class Locreator { locatorObject[locatorId + 'AttrEquals'] = locatorObject[locatorId].attrEquals = (attribute, value) => drivex.validateAttributeValue(locator(), parentWebElement, attribute, value); + locatorObject[locatorId + 'ClearText'] = locatorObject[locatorId].clearText = () => drivex.find(locator(), parentWebElement).then(async (elem) => { const value = await elem.getAttribute('value'); + const backspaceInput = new Array((value || '').length).fill('\b').join(''); + await webElement().sendKeys(backspaceInput); }); + + return locatorObject; } addGroup(locatorJSON) {