I have a form, with many elements (inputs, selections, checkboxes etc..). How can I apply an action to all elements inside the form without explicitly doing it per element?
Here is my code (in Selenium IDE):
storeEval |
window.document.getElementsByTagName('form')[0].id = 'myForm';
window.document.defaultView.getComputedStyle(window.document.myForm.getElementsByTagName('*')).getPropertyValue('background-color');
| result
I get an error: [error] Threw an exception: document.myForm is undefined
I tried to do this:
storeEval |
window.document.getElementsByTagName('form')[0].id = 'myForm';
window.document.defaultView.getComputedStyle(window.document.getElementById('myForm')).getPropertyValue('background-color');
It works correctly.
When I try to do this:
var myForm = document.getElementsByTagName('form')[0];
var children = myForm.childNodes;
I get an error: [error] Threw an exception: document.myForm is undefined
Try this:
JavaScript snippet
selenium.browserbot.getCurrentWindow()gets the window of your application.