java - Element cannot be clickable even I wait the element clickable for 30 seconds -


i trying enter value in txtstockonhand field. but, throws error org.openqa.selenium.timeoutexception: timed out after 30 seconds waiting element clickable: by.id: txtstockonhand wait element clickable.

selenium java code:

@findby(how = how.id, using = "txtstockonhand") static webelement txtstockonhand;  public void waitforclickable(string strelementid){     wait.until(expectedconditions.elementtobeclickable(by. id(strelementid)));           }  // set soh in soh textbox public void setstockonhand(string strstockonhand){     txtstockonhand.sendkeys(strstockonhand); }  public void enterstockonhand(string strstockonhand){     this.waitforclickable("txtstockonhand");             this.setstockonhand(strstockonhand);     txtstockonhand.sendkeys(keys.tab); } 

html code:

to solve problem, used thread.sleep method make whole thread stop while proceed again after period of time.

i don't know why wait.until(visibility) , wait.until(clickable) not functioning somehow.

i hope help.

    // set soh in soh textbox     public void setstockonhand(string strstockonhand){         try {thread.sleep(3000);} //3000 3 second because in millisecond format          catch (interruptedexception e) {e.printstacktrace();}         txtstockonhand.sendkeys(strstockonhand);     } 

just put anywhere before proceed on else.

you can change value in sleeptime, can put in variable :)

happycoding


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -