473,756 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2674

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******@googl email.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.HTTPCoo kieProcessor) 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.testbrowse r 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
3885
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 based site with videos - NO, it's not a porn site though. I thought that I'd list the key requirements/specifications for my web site below and was wondering if some of you'd be so kind as to provide your thoughts on each and comment on them with...
2
1575
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 certain text in a page, follow a certain link, etc. I've begun writing my own (because it's so easy to do in Python), but wondering if there's anything out there like this. Thanks! Robb
0
11564
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 file. I'm not very familiar with this aspect of perl, and have been having some trouble in the POSTing of the form data, while using cookies to log in. Visting the site automatically redirects you to a login page. Once you fill out the login...
2
2317
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 version is: Dim myWebClient As New WebClient Dim nvc As New NameValueCollection nvc.Add("Login", username) nvc.Add("Password", password)
2
2639
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
1317
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 = wc.UploadData("http://www.website.com/login?service2&user=joebloggs&blah","P OST", new byte{}); wcResponse =
1
2828
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 how web forms work, and the examples on the python.org/doc site aren't really helpful. I've found working scripted login code using javascript, but I don't speak javascript. These are the relevant functions:
13
1822
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 would cause a problem if it went further. The basic reason is for publicity of club events. I want to make it easy to use. I suspect a login with a password would be too much effort for most people. I also note that computer literacy is not a...
0
12781
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 problem. I'm using this code in a ASP.NET 2.0 application just in case that matters, maybe someone knows a better way to do this?
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.