Having problems with Webdriver in trying to input text into a form. The form has javascript validation that I can't get rid of. It has an error message enabled by default that only gets removed when valid input is detected (for example if you type IRELAND and press TAB or click away).
Tried using the key.TAB from selenium, didn't work. This is the code:
await driver.wait(until.elementLocated(By.className('combi-select__input')), 15000);
const sets = await driver.findElement(By.className('combi-select__input'));
await sets.sendKeys("IRELAND");
Now when I check the html output, the form is empty and I still get the error. I tried click() on it first.
On the other hand this works:
await driver.wait(until.elementLocated(By.className('combi-select__input')), 15000);
const sets = await driver.findElement(By.className('combi-select__input'));
await driver.executeScript("arguments[0].setAttribute('value','IRELAND');", sets);
The problem with this is that the javascript validation still keeps the error, so the form can't be submitted.
If anyone can help, that would be amazing.
Try using JavascriptExecutor
JavascriptExecutor jse = ((JavascriptExecutor)driver);
WebElement email = driver.findElement(By.id("useremail"));
jse.executeScript("arguments[0].value='-----your input----';", email);