Hi Michael and all,

If I click it by hand in a browser it gives me the browsers download
(open/save) file dialog.

In the webtest results file it gives:
<step>
 <parameter name="description" value="step: check can click option to print
boarding pass"/>
 <parameter name="label" value="Print Boarding Pass. "/>
 <parameter name="resultFilename"
value="response_1182372842528_clickLink.unknown"/>
 <parameter name="taskName" value="clickLink"/>
 <result>
   <completed duration="2703"/>
 </result>
</step>

And the funny thing is that if I open up
response_1182372842528_clickLink.unknown it actually displays the pdf file
in my browser, so I guess I'm closer than I thought to getting it to do what
I want - but how to get it to treat this as a pdf so I can examine it in
webtest validate steps?

I've just checked and the mime type and content headers etc are deliberately
setup so the browser thinks that it is a generic file rather than a pdf as
they want the user to be offered the choice to download or open the file
rather than it being by default opened in the browser.

So I guess the question is whether there is some way I can tell WebTest to
treat it as a pdf?

I inserted your code to write the log and the output was only:

Test Start
[EMAIL PROTECTED]
Test End

regards,
       John

On 6/20/07, Michael Habbert <[EMAIL PROTECTED]> wrote:

Hi John and Pip,


[...]
>      > The site I am testing has a number of pdf documents (tickets etc)
>      > generated on the fly. However, they are generated as downloads
rather
>      > than as pdf links.
>      >
>      > When I use the normal webtest pdf syntax (admittedly new to me)
>     like so:
>      >             <clickLink label="${Txt_AltText_PrintBoardingPass}"
/>
>      >             <pdfVerifyText text="Traveller Info"/>
>      > I get the error
>      > filename="C:\working\cwt\doc\isis\testTest.xml" line="133"
>      > message="Current response is not a PDF page but has following
>     mime type
>      > application/x-download (
>      > [EMAIL PROTECTED])">
>      >
>      > which makes sense when I think about it.
>     [...]
[...]

May be you can identify the UnexpectedPage by using something like:

>                    <groovy>
>                        def logFile = new File('./webtest.log')
>                     logFile.append("\nTest Start\n")
>                     logFile.append(step.context.webClient.toString())
>                       logFile.append("\nTest End\n")
>                    </groovy>

at the right place. So we are able to see what unexpected page shows up.
Btw. what happens if you
click it by hand?

--
Mit freundlichen Grüßen

Michael Habbert


Reply via email to