Solved

cURL based shell script for Web Application Loign test

Posted on 2012-03-30
11
931 Views
Last Modified: 2012-06-19
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
0
Comment
Question by:ashuji
  • 6
  • 3
  • 2
11 Comments
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
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
 

Author Comment

by:ashuji
Comment Utility
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
 

Author Comment

by:ashuji
Comment Utility
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
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
Comment Utility
# the calls are as follows:
curl --cookies-jar cookie-file ......
curl --cokkie cookie-file .....

NOTE that these options use -- (double dash)
0
 

Author Comment

by:ashuji
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:ashuji
Comment Utility
the submit() is a javascript.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> 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
 
LVL 26

Expert Comment

by:arober11
Comment Utility
Alternatively you could use: http://seleniumhq.org/
0
 

Assisted Solution

by:ashuji
ashuji earned 0 total points
Comment Utility
Selenium does not support IE and my appliaiton only work fine in IE so I can't use Selenium.
0
 
LVL 26

Expert Comment

by:arober11
Comment Utility
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
 

Author Closing Comment

by:ashuji
Comment Utility
Selenium was offers as part of solutin and I already knew that Selenium does not work with IE.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now