I am trying to run the following javascript code snippet in my rubir script browser (watir webdriver). I am trying to set read-only element values:
@browser.execute_script("oFormObject = document.forms['/order/orders']; oFormElement = oFormObject.elements[\"order[begin_string]\"];")
When I do this, I get an error, oFormObject is undefined.
But during the execution of the following code, I did not get any errors:
@browser.execute_script("oFormObject = document.forms['/order/orders'];")
I want to get form elements after that when I get an error. How should I run multiple lines of JS code in my watir script. How to select a form, get a form element, and then set the value of this form element.
user1047912
source share