Search code examples
selenium-webdriverselenium-chromedriversendkeys

How to set the value a second time in a text box using selenium if it doesnt get set properly the first time?


On the application I work , after tabbing out of every field, there is an AJAX call , some blue spinner at the bottom . If we enter text in a field while the spinner is present , field doesnt retain its value , is it possible to to write some while loop or something ...

which checks whether value has been set properly or not otherwise re enter it

Thanks

I have tried Send Keys Javascript Executor But they dont work


Solution

  • Try this:

    if(element.getAttribute("value").isEmpty() == true) {
    ((JavascriptExecutor) driver).executeScript("arguments[0].value='someInputText';", element);
    }