467,888 Members | 1,392 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

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
  • viewed: 2506
Share:
3 Replies

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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Robb Shecter | last post: by
reply views Thread by Antwerp | last post: by
2 posts views Thread by Mark Delon | last post: by
1 post views Thread by dmbkiwi | last post: by
13 posts views Thread by Peter Chant | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.