473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Testing a website with HTTPS login and cookies

Hi everyone,

I want to create a test that will do a proper login test to a web site
but I need some pointers.

I need to login to the website by accessing an https url and posting to
that, which should return a very small 302 reply with the address of the
internal page. I need to take that page href and then access it, if I
can do all that then the test passes. Of course because I have to access
two urls I also need cookies for session handling. I've already tried
bash which would have worked but for the cookie handling and webinject
which is written in Perl, but this doesn't do exactly what I want in
terms of output so I'd rather write something myself. (I'm also curious
as to the best way to do this)

If anybody knows how to do this could they please give me a quick
pointer and tell me what libraries I need to go read up on?
Thanks

Hari
Sep 5 '06 #1
3 2659

Hari Sekhon wrote:
If anybody knows how to do this could they please give me a quick
pointer and tell me what libraries I need to go read up on?
One word. Selenium.

-Sandra

Sep 5 '06 #2
"Sandra-24" <sa***********@yahoo.comwrites:
Hari Sekhon wrote:
If anybody knows how to do this could they please give me a quick
pointer and tell me what libraries I need to go read up on?

One word. Selenium.
Didn't sound like a good fit for Selenium to me. Selenium's great,
but if you want to test HTTP response codes, just test HTTP response
codes -- no need to drag your browser into it :-)
John
Sep 7 '06 #3
Hari Sekhon <hp******@googlemail.comwrites:
I want to create a test that will do a proper login test to a web site
but I need some pointers.

I need to login to the website by accessing an https url and posting
to that, which should return a very small 302 reply with the address
of the internal page. I need to take that page href and then access
it, if I can do all that then the test passes. Of course because I
have to access two urls I also need cookies for session handling. I've
already tried bash which would have worked but for the cookie handling
and webinject which is written in Perl, but this doesn't do exactly
what I want in terms of output so I'd rather write something
myself. (I'm also curious as to the best way to do this)

If anybody knows how to do this could they please give me a quick
pointer and tell me what libraries I need to go read up on?
You could just use httplib, or urllib2 (using
urllib2.HTTPCookieProcessor) if you need to handle cookies. However,
personally I prefer using a higher-level tool that knows a bit more
about web-browser behaviour, e.g.:

http://www.idyll.org/~t/www-tools/twill.html
http://cheeseshop.python.org/pypi?%3...opeTestbrowser
both of which are based on:

http://wwwsearch.sourceforge.net/mechanize/
(BTW, I hear there's work going on on an implementation of
zope.testbrowser that delegates to Selenium instead of to mechanize --
cool.)
John
Sep 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Bozo Schmozo | last post by:
Greetings! I've searched groups.google.com already to see if I can determine if using PHP/MySQL (if needed) for a web site I wish to develop. As the subject indicated, it will be a content...
2
by: Robb Shecter | last post by:
Anybody know about a Python library for testing websites? I'm thinking of something like a scriptable browser, where you could tell it to browse to a certain URL, check for the existence of...
0
by: Antwerp | last post by:
Hi, I'm trying to create a perl script that will log into a website (the login form uses POST), navigate to several pages, and append the (html) content parsed from those pages to a seperate log...
2
by: Gill Bates | last post by:
I'm trying to login to a banking site (https://www.providentconnection.com) using vb.net. I've tried many variations of WebClient and HttpWebRequest; none of which I've got to work. My latest...
2
by: Mark Delon | last post by:
Hi, i want to log via python script to https page: 'https://brokerjet.ecetra.com/at/' # But it does not work. I am using following code(see below)
6
by: Alan | last post by:
Hi All, I am trying to make a few calls in succession to a website to allow me to login and then perform a search, in a c# windows program. wcResponse =...
1
by: dmbkiwi | last post by:
I've been using urllib2 to try and automate logging into the google adsense page. I want to download the csv report files, so that I can do some analysis of them. However, I don't really know...
13
by: Peter Chant | last post by:
I'm considering setting a website up for a club. I do not plan the contents to be for public consumption, but on the other hand I'm not going to have anything on there that is confidential, that...
0
by: barrybevel | last post by:
Hi, I'm trying to login to the www.vodafone.ie website using HttpWebRequest. It works fine with IE/Firefox and the .NET Web Control too, just not with my code. I think it's a redirect 302...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.