Hello,
yes Marc, to validate the original response is exactly what i want. Thanks
for the answer, but i allways get the error message:
Exception
groovy.lang.MissingMethodException
Message
No signature of method
com.gargoylesoftware.htmlunit.WebResponseImpl.contentAsString() is
applicable for argument types: () values: {}
I use the 2.5 version of webtest, so i think i have to update canoo webtest.
Thanks,
Dariusch
Florent Blondeau wrote:
>
> Sorry, your last message wasn't in my box...
>
> Strange, it works for me... I use the Webtest 2.6 version (build R_1689)
> I remember I've had this error, but I don't remember why...
>
> I'll check my brain
>
> cheers
>
> Florent
>
> Pingwy
> 27, rue des arènes
> 49100 Angers
>
>
>
> Florent Blondeau a écrit :
>> groovy(description:"Store the html of the page","""
>> def document = step.context.currentResponse.asXml()
>> def props = step.webtestProperties
>> props.putAt("htmlPage",document)
>> """)
>> <invoke description="goto W3C page"
>> url="http://validator.w3.org/#validate_by_input" />
>> <setInputField description='set textarea with feeds'
>> htmlId='fragment'
>> value="#{document}"/>
>> <clickButton description="Submit the simple feedvalidation"
>> xpath="//[EMAIL PROTECTED]'validate-by-input']//[EMAIL PROTECTED]'Check']"/>
>>
>> Did you really used that code ?????? If this is the case, please try
>> the one with a <groovy></groovy> step I mentioned in my first mail.
>> I do not use XML configuration, but I trigger webtest inside Groovy
>> code, so my first proposition was a method-based formulation, not an
>> XML-based one....
>> You should try something like :
>> <groovy description="Store the html of the page">
>> def document = step.context.currentResponse.asXml()
>> def props = step.webtestProperties
>> props.putAt("htmlPage",document)
>> </groovy>
>>
>> <invoke description="goto W3C page"
>> url="http://validator.w3.org/#validate_by_input" />
>> <setInputField description='set textarea with feeds'
>> htmlId='fragment'
>> value="#{document}"/>
>> <clickButton description="Submit the simple feedvalidation"
>> xpath="//[EMAIL PROTECTED]'validate-by-input']//[EMAIL PROTECTED]'Check']"/>
>> as recommended in my second proposition
>>
>> Please let me know if that was the error
>>
>> cheers
>>
>> Florent
>> Pingwy
>> 27, rue des arènes
>> 49100 Angers
>>
>>
>>
>> dariusch a écrit :
>>> Hi,
>>>
>>> if i use value="#{htmlPage}", inside the inputField is the string
>>> #{htmlPage} and not the html code.
>>>
>>> so this solution dosen't work!
>>>
>>> Dariusch
>>>
>>>
>>> Florent Blondeau wrote:
>>>
>>>> Hi Dariusch,
>>>>
>>>> if i use these groovy steps, where are the html code, inside the
>>>> document
>>>> property?
>>>>
>>>> Nope, it should be in the htmlPage property, so your code should be :
>>>>
>>>> <setInputField description='set textarea with feeds'
>>>> htmlId='fragment'
>>>> value="#{htmlPage}"/>
>>>>
>>>> Florent
>>>>
>>>> Pingwy
>>>> 27, rue des arènes
>>>> 49100 Angers
>>>>
>>>>
>>>>
>>>> dariusch a écrit :
>>>>
>>>>> Hello,
>>>>>
>>>>> if i use these groovy steps, where are the html code, inside the
>>>>> document
>>>>> property?
>>>>> I will do this:
>>>>>
>>>>> groovy(description:"Store the html of the page","""
>>>>> def document = step.context.currentResponse.asXml()
>>>>> def props = step.webtestProperties
>>>>> props.putAt("htmlPage",document)
>>>>> """)
>>>>> <invoke description="goto W3C page"
>>>>> url="http://validator.w3.org/#validate_by_input" />
>>>>> <setInputField description='set textarea with feeds'
>>>>> htmlId='fragment'
>>>>> value="#{document}"/>
>>>>> <clickButton description="Submit the simple feedvalidation"
>>>>> xpath="//[EMAIL PROTECTED]'validate-by-input']//[EMAIL
>>>>> PROTECTED]'Check']"/>
>>>>>
>>>>> I think, to set the value inside setInputField over the #{document} is
>>>>> not
>>>>> correct.
>>>>>
>>>>> What is my mistake?
>>>>>
>>>>> Thanks,
>>>>> Dariusch
>>>>>
>>>>>
>>>>>
>>>>> Florent Blondeau wrote:
>>>>>
>>>>>
>>>>>> Hi Dariusch,
>>>>>>
>>>>>> You can get the html via a groovy step
>>>>>>
>>>>>> groovy(description:"Store the html of the page","""
>>>>>> def document =
>>>>>> step.context.currentResponse.asXml()
>>>>>> def props = step.webtestProperties
>>>>>> props.putAt("htmlPage",document)
>>>>>> """)
>>>>>>
>>>>>> or
>>>>>> <groovy description="Store the html of the page">
>>>>>> def document =
>>>>>> step.context.currentResponse.asXml()
>>>>>> def props = step.webtestProperties
>>>>>> props.putAt("htmlPage",document)
>>>>>> </groovy>
>>>>>> in a less groovy way...
>>>>>>
>>>>>> Then you have your html code (cleaned up with Tidy) in the htmlPage
>>>>>> property
>>>>>>
>>>>>> Hope that helps
>>>>>>
>>>>>> Florent
>>>>>>
>>>>>> Pingwy
>>>>>> 27, rue des arènes
>>>>>> 49100 Angers
>>>>>>
>>>>>>
>>>>>>
>>>>>> dariusch a écrit :
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> if i use storexpath with ='/', i get the text without the elements,
>>>>>>> but
>>>>>>> i
>>>>>>> need all.
>>>>>>>
>>>>>>> Someone has an idea?
>>>>>>>
>>>>>>> Dariusch
>>>>>>>
>>>>>>>
>>>>>>> dariusch wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> i just want to store all source code from a response page. It is
>>>>>>>> possible
>>>>>>>> to do that (inside a variable)? I need this, because i will check
>>>>>>>> these
>>>>>>>> sources it is valid (the page is an rss-feed).
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Dariusch
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>
>
--
View this message in context:
http://www.nabble.com/How-to-store-the-source-code-from-a-response-page.-tp16297922p16718643.html
Sent from the WebTest mailing list archive at Nabble.com.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest