Sometimes you need to enter data into web controls which are disabled.
But Selenium will throw exceptions saying element is disabled.
So you need to make use of JavaScriptExecutor interface in this scenario.
With JavaScriptExecutor, you can set the data into editbox easily using below syntax.
(JavaScriptExecutor (driver)).executeScript("arguments[0].value = abc", webelement );
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
But Selenium will throw exceptions saying element is disabled.
So you need to make use of JavaScriptExecutor interface in this scenario.
With JavaScriptExecutor, you can set the data into editbox easily using below syntax.
(JavaScriptExecutor (driver)).executeScript("arguments[0].value = abc", webelement );
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
Hi
ReplyDeleteI tried above example but am getting arg is undefined error.
hello - there was an typo error. Please use arguments[0]. (not arg)
Delete