Solved

cURL based shell script for Web Application Loign test

Posted on 2012-03-30
11
945 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
ID: 37790164
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
ID: 37794739
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
ID: 37795594
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 37795833
# 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
ID: 37799792
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
 

Author Comment

by:ashuji
ID: 37799817
the submit() is a javascript.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37799887
> 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
ID: 37804184
Alternatively you could use: http://seleniumhq.org/
0
 

Assisted Solution

by:ashuji
ashuji earned 0 total points
ID: 37804887
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
ID: 37805019
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
ID: 38098783
Selenium was offers as part of solutin and I already knew that Selenium does not work with IE.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need To Change Centos 6 Timestamp Form In Log File 24 72
Jquery GMAP3 Hierarchy 1 28
javascript: add id amounts 5 47
how can i apply an assert arrayEqual function ? 2 27
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

803 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