| Author |
Using WebTestCase api how can to set value to hidden field
|
Annapoorni Moorthy
Greenhorn
Joined: Feb 07, 2013
Posts: 2
|
|
|
I am using WebTestCase for my httpunit test case version is 1.2. I have a form with input hidden field, the value of this hidden field is set through a JS function on submitting the form , I am clueless as to how to achieve this in test case , to submit the form previously we had a link , which on clicking calls the JS fucntion which sets the value and then submits the form , now the code has been changed to submit the form on pressing enter key. So I am stuck here , as to how to set the hidden filed value because setFormElement throws Exception as cannot set the value for hidden field , I came across methods like setHiddenField() but this version of WebTestCase wont soupport it . What can I try as other alternatives . If I am unclear please let me know , I ll try to be more specific.
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Annapoorni Moorthy wrote:... now the code has been changed to submit the form on pressing enter key. So I am stuck here , as to how to set the hidden filed value because setFormElement throws Exception as cannot set the value for hidden field ,
Check if you can create Enter Key press event somehow using WebTestCase, OR atleast execute a JS script which will do that for you, something like done here: http://stackoverflow.com/questions/4832776/in-javascript-how-can-i-create-my-own-keyboard-event
|
 |
Annapoorni Moorthy
Greenhorn
Joined: Feb 07, 2013
Posts: 2
|
|
Sagar Rohankar wrote:
Annapoorni Moorthy wrote:... now the code has been changed to submit the form on pressing enter key. So I am stuck here , as to how to set the hidden filed value because setFormElement throws Exception as cannot set the value for hidden field ,
Check if you can create Enter Key press event somehow using WebTestCase, OR atleast execute a JS script which will do that for you, something like done here: http://stackoverflow.com/questions/4832776/in-javascript-how-can-i-create-my-own-keyboard-event
Thanks for the help.
|
 |
 |
|
|
subject: Using WebTestCase api how can to set value to hidden field
|
|
|