selenium webdriver - The method setAttribute(String, String) is undefined for the type WebElement -


this code:

 driver.findelement(by.id("input_17")).setattribute("value", "selected"); 

getting error

"the method setattribute(string, string) undefined type webelement" when try change attribute of webelement.

but "getattribute" not giving error.

according documentation webelement doesn't have setattribute method. using javascriptexecutor:

javascriptexecutor jsexecutor = (javascriptexecutor) driver; jsexecutor.executescript("document.getelementbyid('input_17').setattribute('value', 'selected')"); 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

c++ - Fill edges and center of array/vector with different values -

sql - calculate weighted average for each day and id based on time intervals in PostgreSQL -