[Webtest] HTTP error 302
John and Pip
John and Pip" <pipandjohn@gmail.com
Wed, 3 Jan 2007 09:00:52 +1300
Hi Again,
I have now tried loading these pages using Tamper Data to try to look
at what happens.
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ?review?initValidate=
PNR.do
returns a 302 error and then I get
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForF=
lights.do?review?initValidatePNR.do
which returns a 200 code.
So I will try to track down the app developers and find out what is going o=
n.
But, I still don't understand why WebTest can't handle the proper URL:
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/review/initValidate=
PNR.do
When I look at this in Tamper Data it shows the first load of this
page giving a 302 error, then a second load of the same page giving a
200 result.
So I think I was on the right track below that WebTest is failing
because it can't handle the same page being reloaded as per this:
[invoke] DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Got a
redirect status code [302] new
location=3D[https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/review/=
initValidatePNR.do]
[invoke] WARN (com.gargoylesoftware.htmlunit.WebClient) - Got a
redirect but the location is the same as the page we just loaded
[https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/review/initValidat=
ePNR.do].
Skipping redirection.
[invoke] INFO (com.gargoylesoftware.htmlunit.WebClient) -
statusCode=3D[302] contentType=3D[text/html]
...
[invoke] DEBUG (com.canoo.webtest.steps.Step) - Step failed at
C:\WebTest\doc\ISIS\testTest.xml:9: with exception
[invoke] com.canoo.webtest.engine.StepFailedException: Step[invoke
"Get the ISIS retrieve booking page" (1/1)]: HTTP error 302, at:
invoke, Step: InvokePage at C:\WebTest\doc\ISIS\testTest.xml:9: with
(resultFilename=3D"response_1167767144056_invoke.html",
taskName=3D"invoke")
I tried using Canoo Webtest: R_1438 then with Canoo Webtest: R_1454
with same result.
Is this a defect in WebTest that I should raise in JIRA and is there a
workaround? Any help much appreciated!
regards,
John
On 1/3/07, John and Pip <pipandjohn@gmail.com> wrote:
> Hi,
>
> I posted some months back about HTTP 302 errors, and in the thread
> below (snipped down somewhat) was given advise to use ? rather than /
> in the URL so I changed it to :
> url=3D"https://flightbookings.airnewzealand.co.nz?isbook_en_NZ?book?initS=
earchForFlights.do
> and it worked.
>
> However, I now need to be able to hit a second "start page" in the
> same web application. That is the URL:
> https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/review/initValida=
tePNR.do
> This is a public URL and if you hit it you get a page headed up
> "Retrieve online booking" and with a page title starting "Air New
> Zealand Bookings - Retrieve Booking".
>
> This gives the same 302 error in WebTest.
>
> <failure message=3D"com.canoo.webtest.engine.StepFailedException:
> Step[invoke "Get the ISIS retrieve booking page" (1/1)]:
> HTTP error 302, at: invoke, Step: InvokePage at
> C:\WebTest\doc\ISIS\testTest.xml:6: with
> (resultFilename=3D"response_1167729673189_invoke.html",
> taskName=3D"invoke")"/>
>
> At warn level the console shows:
>
> [invoke] WARN (com.gargoylesoftware.htmlunit.WebClient) - Got a
> redirect but the location is the same as the page we just loaded
> [https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/review/initValid=
atePNR.do].
> Skipping redirection.
>
> Which perhaps is the clue - does this site require a redirection to
> the same URL, and if so is there any way to make WebTest / HTMLUnit
> *not* ignore this?
>
> However, when I follow the same trick of changing / to ? as per:
>
> https://flightbookings.airnewzealand.co.nz/isbook_en_NZ?review?initValida=
tePNR.do
>
> I get taken to a completely different page - specifically to
> https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchFo=
rFlights.do
>
> The same thing happens if I put that URL directly into a browser so
> I'm just completely confused. Can anyone shed any further light on
> this for me please?
>
> thanks and regards,
> John
>
> Here is the script:
>
> <webtest name=3D"Retrieve PNR" description=3D"no desc yet" >
> &config;
> <steps>
> <invoke
> url=3D"https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/review/ini=
tValidatePNR.do"/>
> </steps>
> </webtest>
>
> and here is the config content:
> <config
> host=3D"registration.airnewzealand.com"
> port=3D"443"
> protocol=3D"https"
> basepath=3D""
> summary=3D"true"
> saveresponse=3D"true"
> resultpath=3D"..\webtest-results"
> resultfile=3D"results.xml"
> showhtmlparseroutput=3D"false"
> autorefresh=3D"true"
> haltonfailure=3D"false"
> timeout=3D"120">
> <option name=3D"RedirectEnabled" value=3D"true" />
> </config>
>
> I had appended the full debug level output but it exceeded the 40k
> limit so have omitted it.
>
> On 11/18/06, John and Pip <pipandjohn@gmail.com> wrote:
> > Hi Aarathi and Paul,
> >
> > I tried it and it works. I'm kind of amazed at the apparent black arts
> > involved here - is it some sort of strange handling of pseudo-directory
> > paths in URLS? I notice the URL with the ?s works directly into a brows=
er as
> > well.
> >
> > But I don't understand your comment paul. I wanted it to follow redirec=
ts so
> > if default behaviour is to do so why do I need to replace / with ? in t=
he
> > URLs?
> >
> > Thanks and regards,
> > John
> >
> >
> > On 11/17/06, Paul King <paulk@asert.com.au> wrote:
> > > Rob Manthey wrote:
> > > > ok, a moment to learn something ... is this simply the final url (a=
fter
> > > > the 302 redirect) or is there something else going on here?
> > >
> > > The default behaviour is to follow redirects. If you want to visit
> > > the 302 page you have to turn redirects off among other things.
> > > I guess we should document this better as it arises quite frequently.
> > >
> > > Cheers,
> > >
> > > Paul.
> > >
> > > > on 17/11/06 11:49 Aarathi Niranjan said the following:
> > > >>
> > > >> Just a suggestion =85 this works for me =85 try it:
> > > >>
> > > >>
> > > >>
> > > >> =85
> > > >>
> > > >> <steps>
> > > >>
> > > >> <invoke description=3D"ISIS SFF NZ search =
page"
> > > >>
> > url=3D"https://flightbookings.airnewzealand.co.nz?isbook_en_NZ?book?ini=
tSearchForFlights.do
> > "
> > > >> />
> > > >>
> > > >> </steps>
> > > >>
> > > >> =85
> > > >>
> > > >>
> > > >>
> > > >> Hope that helps.
> > > >>
> > > >>
> > > >>
> > > >>
> > -----------------------------------------------------------------------=
-
> > > >>
> > > >> *From:* webtest-admin@lists.canoo.com
> > > >> [mailto: webtest-admin@lists.canoo.com] *On Behalf Of *Charlie Kuh=
arski
> > > >> *Sent:* Thursday, November 16, 2006 2:50 PM
> > > >> *To:* webtest@gate2.canoo.com
> > > >> *Subject:* Re: [Webtest] HTTP error 302
> > > >>
> > > >>
> > > >>
> > > >> Reaching via a browser is fine. I can see it also. Know that Web=
Test
> > > >> is build upon the HtmlUnit's API.
> > > >> As far as being reachable via HtmlUnit, this is only a guess, but =
I'm
> > > >> guessing the URL is passed through to be used by HtmlUnit. So I'm
> > > >> guess it's the culprit. There is a slight chance it's WebTest
> > > >> mangling the name somehow, but I doubt it. Wouldn't know for sure
> > > >> until someone looks at the source.
> > > >> Try using the IP address instead.
> > > >>
> > > >> John and Pip wrote:
> > > >>
> > > >> Hi Charlie,
> > > >>
> > > >> Thanks for your response.
> > > >>
> > > >> Do you mean you couldn't reach
> > > >>
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do
> > > >> from a browser or that you think WebTest believes it is not reacha=
ble?
> > > >> This is the main public URL of the Air New Zealand flight booking
> > > >> engine, and we have a screen up in the office showing bookings com=
ing
> > > >> through every minute!
> > > >>
> > > >> re testing with HTMLUnit: I'm not a java programmer - just a teste=
r,
> > > >> trying to figure out whether I need to be a java programmer to use
> > > >> WebTest!
> > > >>
> > > >> Thanks for the hint re version number. I see this is R_1389. In fa=
ct
> > > >> to my embarrassment I see this even appears in my email below!
> > > >>
> > > >> regards,
> > > >> John
> > > >>
> > > >> On 11/17/06, *Charlie Kuharski* <ckuharsk@nmdp.org
> > > >> <mailto: ckuharsk@nmdp.org>> wrote:
> > > >>
> > > >> Your host is not reachable. I'm guessing it HtmlUnit. Try using
> > > >> something without the "...co.nz". You could try and test with Html=
Unit.
> > > >> An ugly was to discover the version is to
> > > >>
> > > >> 1) replace your steps with this only:
> > > >> <verifyTitle
> > > >> description=3D"we should see the login title"
> > > >> text=3D"Login Page" />
> > > >>
> > > >> 2) you should see something like:
> > > >> C:\test\Translink\gtest1.xml:12: Canoo Webtest:
> > R_1393.
> > > >> Test failed.
> > > >> Exception raised:
> > com.canoo.webtest.engine.StepExecutionException : No
> > > >> current response available! Is previous invoke miss
> > > >> itle at C:\test\Translink\gtest1.xml:30: with
> > (description=3D"we should
> > > >> see the login title", taskName=3D"verifyTitle", text
> > > >> anoo.webtest.engine.StepExecutionException: No current
> > response
> > > >> available! Is previous invoke missing?, Step: VerifyTitle
> > > >> nk\gtest1.xml:30: with (description=3D"we should see the login ti=
tle",
> > > >> taskName=3D"verifyTitle", text=3D"Login Page")
> > > >>
> > > >> Good luck.
> > > >>
> > > >>
> > > >>
> > > >> John and Pip wrote:
> > > >>
> > > >> Hi,
> > > >>
> > > >> I have a test that is failing to follow a 302 error. I've searched=
the
> > > >> archives and played around trying to enable redirects but nothing
> > > >> seems to work.
> > > >>
> > > >> Below is the stripped-down test (just one invoke) and the output. =
This
> > > >> is a publicly available page so you can hit
> > > >>
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do
> > > >> from either IE or Firefox so I'm hoping someone can help me figure=
out
> > > >> how to hit this page from WebTest! Note that I've tried an interna=
l
> > > >> page that is http rather than https and get the same problem so it
> > > >> isn't related to SSL.
> > > >>
> > > >> I am using Java 1.5.0.6 < http://1.5.0.6>, HTMLUnit 1.10 and WebTe=
st
> > > >> R_1393 (I think! How can I verify this?).
> > > >>
> > > >> Regards,
> > > >>
> > > >> John
> > > >>
> > > >> <?xml version=3D"1.0"?>
> > > >>
> > > >> <!DOCTYPE project SYSTEM "WebTest.dtd">
> > > >>
> > > >> <project name=3D"OLH" basedir=3D"." default=3D"main">
> > > >>
> > > >> <property name=3D"webtest.home" location=3D"..\.."/>
> > > >>
> > > >> <import file=3D"${ webtest.home}/lib/taskdef.xml"/>
> > > >>
> > > >> <target name=3D"main">
> > > >>
> > > >> <webtest name=3D"ISIS SFF NZ Search">
> > > >>
> > > >> <steps>
> > > >>
> > > >>
> > <invoke
> > > >> description=3D"ISIS SFF NZ search page" url=3D"
> > > >>
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do"
> > > >> />
> > > >>
> > > >> </steps>
> > > >>
> > > >> </webtest>
> > > >>
> > > >> </target>
> > > >>
> > > >> </project>
> > > >>
> > > >>
> > > >>
> > > >> Here is the output:
> > > >>
> > > >>
> > > >>
> > > >> <?xml version=3D" 1.0" encoding=3D"UTF-8"?>
> > > >>
> > > >> <summary Implementation-Title=3D"Canoo Webtest"
> > > >> Implementation-Version=3D"R_1389">
> > > >>
> > > >> <testresult endtime=3D"Fri Nov 17 09:25:42 NZDT 2006"
> > > >>
> > > >> location=3D"F:\WebTest\doc\ISIS\tempTest.xml:7:
> > " starttime=3D"Fri
> > > >> Nov 17 09:25:40 NZDT 2006"
> > > >>
> > > >> successful=3D"no" testspecname=3D"ISIS SFF NZ Search">
> > > >>
> > > >> <config>
> > > >>
> > > >> [snipped because I give the full URL below =96 get sam=
e
> > > >> result if set up config properly including port 443]
> > > >>
> > > >> </config>
> > > >>
> > > >> <results>
> > > >>
> > > >> <step>
> > > >>
> > > >> <parameter name=3D"description" value=3D"ISIS SFF =
NZ
> > > >> search page"/>
> > > >>
> > > >> <parameter name=3D"method" value=3D"GET"/>
> > > >>
> > > >> <parameter name=3D"resultFilename"
> > > >> value=3D"response_1163708742276_invoke.html"/>
> > > >>
> > > >> <parameter name=3D"taskName" value=3D"invoke"/>
> > > >>
> > > >> <parameter name=3D"url"
> > > >> value=3D"
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do
> > > >> <
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do
> > >"/>
> > > >>
> > > >>
> > > >> <result>
> > > >>
> > > >> <failed duration=3D"1469"/>
> > > >>
> > > >> </result>
> > > >>
> > > >> <htmlparser>
> > > >>
> > > >> <error col=3D"1" line=3D"1" url=3D"
> > > >>
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do">Empty
> > > >> document.</error>
> > > >>
> > > >> </htmlparser>
> > > >>
> > > >> </step>
> > > >>
> > > >> <failure
> > > >> message=3D"com.canoo.webtest.engine.StepFailedException:
> > Step[invoke
> > > >> "ISIS SFF NZ search page" (1/1)]: HTTP error 302, at:
> > > >> invoke, Step: InvokePage at
> > F:\WebTest\doc\ISIS\tempTest.xml:9: with
> > > >> (description=3D"ISIS SFF NZ search page",
> > > >> method=3D"GET",
> > > >>
> > resultFilename=3D"response_1163708742276_invoke.html",
> > > >> taskName=3D"invoke",
> > > >>
> > url=3D"https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/boo=
k/initSearchForFlights.do"
> > > >> <
> > https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearch=
ForFlights.do">;)"/>
> > > >>
> > > >> </results>
> > > >>
> > > >> </testresult>
> > > >>
> > > >> </summary>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > >
> > > _______________________________________________
> > > WebTest mailing list
> > > WebTest@lists.canoo.com
> > > http://lists.canoo.com/mailman/listinfo/webtest
> > >
> >
> >
>