I'm facing an issue when trying to clear the text box. The error message I am receiving is:
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 30.14 seconds
Below is the HTML code snippet in question:
<input id="cardZipCode" class="padding-left8" type="text" autocomplete="false" maxlength="5" value="10251" name="cardZipCode"/>
The method I am using involves checking for the element's ID attribute. Interestingly, while the textbox is enabled, it appears that it is not displayed. Consequently, attempts to clear the text box result in the
org.openqa.selenium.ElementNotVisibleException
.
Furthermore, I have also tried utilizing the following JavaScriptExecutor code:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('cardZipCode').value = ' ';");
Unfortunately, this approach yields the same error.
If anyone has insights on how to resolve this issue, your assistance would be greatly appreciated. Thank you!