Marc,

thank you, I have to admit that I was a bit vague on some of what I
wanted to do but at least now I have an example of how to alter the
underlying HtmlUnit *PageCreator. That helps a lot since I was hoping I
could avoid a dig into lower level infrastructure on a hunt that might
not have paid off quickly.

In fact, I can use that approach for quite a few of the other strange
formats we are dealing with. They do have different mime types, some
non-standard.

WML can be parsed as XML, I was hoping to use exactly the same XPath
expressions for all the various formats. I suppose an XSLT conversion
was more what I was hoping for.

Doing them differently in Webtest seemed a bit difficult since it would
involve a switch type of statement for each <verify...  xpath=... />;
that is, the xpath attribute value will be different for each mime type.

Again, thank you. I will do something such as the attached,
George

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marc Guillemot
Sent: Thursday, April 03, 2008 1:03 AM
To: [email protected]
Subject: Re: [Webtest] Using different Web Protocols?

George,

text/vnd.wap.wml is parsed by HtmlUnit as xml, not as html. Is that
incorrect?

You can simply use HtmlUnit API to change the kind of pages that are
created depending on the content type, for instance like that:

<webtest name="test">
<groovy>
import com.gargoylesoftware.htmlunit.*
class MyPageCreator extends DefaultPageCreator
{
  public Page createPage(
            final WebResponse webResponse,
            final WebWindow webWindow)
  {
    def contentType = webResponse.getContentType().toLowerCase();
    if (contentType == "text/vnd.wap.wml")
    {
      return createHtmlPage(webResponse, webWindow)
    }
    else
      return super.createPage(webResponse, webWindow)
  }
}
step.context.webClient.pageCreator = new MyPageCreator()
</groovy>
...
</webtest>

Nevertheless I don't really understand what you expect with XPath on
text reponses...

Cheers,
Marc.
-- 
Blog: http://mguillem.wordpress.com


George Policello wrote:
> Follow-up:
> 
> I try to pick various types of public links for testing since that is
> easier than trying to create every option for myself.
> 
>>From the below note, I would have expected the page content to be
passed
> through for the link I was trying. However, it failed with the
following
> message.
> 
>
=======================================================================
> Message
> 
> Current response is not an HTML page but of type text/vnd.wap.wml
>
=======================================================================
> 
> George
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Marc Guillemot
> Sent: Wednesday, April 02, 2008 2:25 AM
> To: [email protected]
> Subject: Re: [Webtest] Using different Web Protocols?
> 
> Hi,
> 
> HtmlUnit builds a different subclass of Page depending on the mime
type
> of the response. Only 2 types "family" are parsed: html and xml, text
> and others are just read as received.
> 
> With this explanations, can you precise what you want to do?
> 
> Cheers,
> Marc.


_______________________________________________
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