I am using the script to set the value of the hidden form field variable formContent to the value 'Hello'. Selenium Webdriver doesn't set the value of the hidden form field as it is not visible.
Here is my code:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return jQuery('input:hidden[id$=\"formContent\"]').val('Hello');");
I am getting the script is unresponsive. Could you please tell me what I am doing wrong here. The formContent is defined in my xhtml as follows:
<input type="hidden" id="formContent" name="formContent" value="" />
If use the following lines of code, then it is not setting the value of the hidden form field "formContent":
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("jQuery('input:hidden[id$=\"formContent\"]').val('Hello');");
Thanks!