From b31c788571160f2539bf9e1db4641b84f655a9ef Mon Sep 17 00:00:00 2001 From: Kiran Date: Wed, 29 Sep 2021 12:51:04 +0530 Subject: [PATCH] Added clearText --- lib/locreator.js | 5 +++++ 1 file changed, 5 insertions(+) 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) {