Thanks FNC, I do appreciate you response.
Here, in fact, I need to provide the scenario.
I have an HTML page, sections of which are :
Code:
...
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function validat()
{
if (document.form1.name.value=="" || document.form1.name.value=="0" || document.form1.name.value=="1")
{
alert("Please enter your Roll No.");
return false;
}
else
{ return true; }
}
</SCRIPT> </HEAD>
...
<BODY>
...
<form name="form1" method="post" action="Result.asp" onSubmit="return validat();">
<input name="RollNo" type="text" id="RollNo">
<input name="Submit" type="submit" value=" Search ">
</form>
...
Clearly, the page:
- has an input text field (for RollNo) and a 'search' button
- when 'search' button is clicked validate() javascript is triggered.
- If the input (RollNo) was not empty, neither a zero nor a one, then this input is passed to Result.asp (serverside script)
- Result.asp returns a page containing Result of the RollNo passed to it.
What I want
I have to get the results of many or all. I know range of RollNos (suppose from 1 to 100). Doing this manually will be hard. I want to automate the process through a bash script in Linux.
Here is my approach for this:
In a shell script run a loop from i=1 to 1=100
For each 'i' do this:
- Change:
Code:
<input name="RollNo" type="text" id="RollNo"> to <input name="RollNo" value = "i" type="text" id="RollNo">
[value attribute is added with RollNo]
- Trigger validate() script to submit the form.
- Use wget (or something like that) to save downloaded page (that contains result) in temp.html
- Use awk (or something like that) to append the result to AllResults.txt
- Change i to i+1
My problem is how to trigger this validate() script, that in a separate HTML file through a bash script.
Best Regards