Hi Kate,

It's actually difficult to print files across different browsers and
platforms. WebTest's browser simulator, HtmlUnit, doesn't as far as
I know attempt to simulate that part of a browser itself. If you are
happy to stick with one browser (certainly risky these days) then
you have several options open to you, for example you could use one
of the direct browser drivers. I like Watij. See here for the Groovy
integration:

http://groovy.codehaus.org/Testing+Web+Applications

But I don't know what printing support it provides. In theory if
IE supports it you should be able to poke it. Similarly, if you
are happy to stick with Firefox you could drive that.

Sticking with WebTest probably provides two options. One option is
to try to utilise Java printing - but it is tricky in the general
case because the link could be HTML, XML, PDF, Jpeg, Avi, etc.
The other option is to assume you are running your tests on a
particular platform and then you have a few options up your sleeve.
If you assume you are running on Windows, you might get away
with something like:

   <invoke url="..."/>
   <groovy><![CDATA[
   import org.codehaus.groovy.scriptom.ActiveXProxy
   def page = step.context.currentResponse.page
   def shell = new ActiveXProxy("Shell.Application")
   page.anchors.each{
     response = it.openLinkInNewWindow().webResponse
     def outFile = step.context.getResponseFile(response, "temp", "print")
     outFile.withWriter{ it << response.contentAsStream }
     def folder = shell.NameSpace(outFile.parent)
     def file = folder.ParseName(outFile.name)
     file.InvokeVerb("Print")
   }
   ]]></groovy>

Windows scripting is sometimes a bit temperamental. What printer it
goes to and how it gets there will depend on how your system is configured.
Also, you may not get all of the embedded graphics and images with the
above simple example.

You can achieve the same thing by going to your results directory,
selecting all the response files, right-clicking and selecting "Print".

I guess the real question is why do you need to print the files out?
If you use WebTest's reporting, then you will have each link saved away
in your test results. Wouldn't this suffice for checking between the
results of different runs?

Cheers, Paul.


[EMAIL PROTECTED] wrote:
I am totally new to canoo and need help.

From a page which has a table listing of links I have to click each link in
turn and print off the page that is opened - any help would be gratefully
received.

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest



_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to