java - Unable to use send keys for disabled Element in selenium -


the input field trying write code in selenium:

input class="tt-hint" type="text" disabled="" spellcheck="off" autocomplete="off" style="position: absolute; top: 0px; left: 0px; border-color: transparent; box-shadow: none; background: none repeat scroll 0% 0% rgb(255, 255, 255);" 

my code is:

webelementy inp= driver.findelement(by.classname("tt-hint"));  inp.sendkeys(new string[] { "mo" }); 

but above code not work. error keep getting is:

exception in thread "main" org.openqa.selenium.invalidelementstateexception: element disabled , may not used actions

any appreciated.

i have modified code

javascriptexecutor js = (javascriptexecutor) driver; js.executescript("arguments[0].removeattribute('disabled')",inp);

inp.sendkeys("mo"); output output

the exception says all. element not ready accept interaction , disabled. javascript option here. remove disabled attribute , use sendkeys()

string script = "document.getelementsbyclassname('tt-hint')[1].removeattribute('disabled')"; javascriptexecutor js = (javascriptexecutor)driver; js.executescript(script);  webelementy inp= driver.findelement(by.classname("tt-hint")); inp.sendkeys("whatever"); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -