Sunday 10 May 2015

Element is disabled exception in Selenium Webdriver.

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

2 comments:

  1. Hi
    I tried above example but am getting arg is undefined error.

    ReplyDelete
    Replies
    1. hello - there was an typo error. Please use arguments[0]. (not arg)

      Delete

Buy Best Selenium Books

Contributors