cURL based shell script for Web Application Loign test

Hi

I want to develop a cURL based shell script in Linux (RHEL 5) so that it could connect java based web application login page which is JSP page, login, after login browse few links and tabls inside it and then logs out.

I have seen few tutorials on Internet about cURL but could not make out how to use the cURL based shell script to do the above mentioned task

I want to use this cURL based shell script to automate the web application testing.

If I run command :

curl -cookies http://10.192.34.17:9090/Web/JSP/AstraWorkFlow/login/logon.jsp

It returns the login page similar to the one attached.
login.jsp.txt
ashujiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ahoffmannConnect With a Mentor Commented:
# the calls are as follows:
curl --cookies-jar cookie-file ......
curl --cokkie cookie-file .....

NOTE that these options use -- (double dash)
0
 
ahoffmannCommented:
first: I guess you mean to use --cookie-jar instead of -cookie option to store the cookie in a file
second: you need to use curl a 2'nd time with the previsous stored cookie-jar and pass proper login credentials
0
 
ashujiAuthor Commented:
HI

Thanks for suggestion.  I am new to curl and could not exactly understand what you were trying to suggest, is it possible if you can show an example command for loggin into the JSP page I attached in my question.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
ashujiAuthor Commented:
I tried what you said, I first ran above mentioned URL with --cookies-jar and then below mentioned URL for loggin in, but it again brings login page instead of showing logged in:

curl -cookies-jar --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" "http://192.168.1.10:9090/Web/JSP/WebappWorkFlow/login/logon.jsp?username=test&password=test&press=%20Log%20In%20" > login.html

Please refer to the login file attached in my qustion and suggest what changes may I make.
0
 
ashujiAuthor Commented:
I tried these, after running second command if I store the output of second command in a file say page.html and then view that file using links command, it shows error "session expired".

Looks like its unable to login,  can you please examin the JSP file I attached, should I used function submit() instead of using "ress=%20Log%20In%20" in my first link ?
0
 
ashujiAuthor Commented:
the submit() is a javascript.
0
 
ahoffmannCommented:
> the submit() is a javascript.
simplest is to use a proxy or browser plugin and see what this javascript actually sends, then c&p the request to the curl call
with FF you can use LiveHTTPHeader or TamperData add-on
0
 
arober11Commented:
Alternatively you could use: http://seleniumhq.org/
0
 
ashujiConnect With a Mentor Author Commented:
Selenium does not support IE and my appliaiton only work fine in IE so I can't use Selenium.
0
 
arober11Commented:
Selenium has a driver to playback written/recorded sessions on IE, but if you want a toll that can record / play back in IE have a look at iMacro's, not as flexible as Selenium but does the basics, see: http://www.iopus.com/imacros/home/ie/welcome-v8.htm.
0
 
ashujiAuthor Commented:
Selenium was offers as part of solutin and I already knew that Selenium does not work with IE.
0
All Courses

From novice to tech pro — start learning today.