An input field deletes the value after it’s entered using SendKeys via JS in Selenium. The value appears briefly, then disappears. How to fix this?
I am using Java with selenium & maven.
WebDriverWait wait = new WebDriverWait(DriverManager.getDriver(), Duration.ofSeconds(10));
WebElement field = wait.until(ExpectedConditions.elementToBeClickable(By.id("spocData[0].spocDetails.email")));
JavascriptExecutor js = (JavascriptExecutor) DriverManager.getDriver();
js.executeScript("arguments[0].scrollIntoView(true);", field);
js.executeScript("arguments[0].value='[email protected]';", field);
I have tried multiple xpath.
Selenium Sendkeys method.
Sendkeys by Mouse Actions.
Tried Resetup of whole project.