Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

cURL based shell script for Web Application Loign test

Posted on 2012-03-30
11
Medium Priority
?
965 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 1500 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

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

660 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