gettext of html form field interprets text as HTML/XML.

24 views
Skip to first unread message

steven.yetter

unread,
Sep 7, 2011, 4:08:01 PM9/7/11
to selenesse-users
I have a target test application that accepts XML data posted as part
of a form and returns an XML response. I wrote a containing HTML page
that accepts the XML response and puts it into an HTML TEXTAREA
control for display. A simple response would be displayed on the HTML
page in a TEXTAREA field like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ResponseMsg>
<ResponseMsg Version="2.0"><Status>SUCCESS</Status></ResponseMsg>

My selenesse test site instructs selenium to "check gettext
id=responsetext" to retrieve that text. When selenesse shows the
results of a test run, the entire XML is displayed as SUCCESS. All
the xml nodes are interpreted (i guess) and only the text is shown.
For a simple response no big deal, but sometimes the response is a
table of columns and rows and in that case all the cells run together
as one long text string with no delimeters on the cell boundaries.

So in the test HTML app in the TEXTAREA field I wrapped the text with
CDATA and it made no difference, other than to put the trailing ]] of
the CDATA section after the text.

Any ideas for sending the XML data in such a way that either the
complete xml can be processed in SELENESSE or that the NODES can be
maintained as some form of delimeter?

By the way, for the XML going out, i put the xml into a variable,
otherwise many of the nodes in CamelCase got interpreted as page
references., Apparently the ! on the front of define helps to keep
the variable from being interpreted as HTML.

Chris McMahon

unread,
Sep 7, 2011, 4:33:12 PM9/7/11
to selenes...@googlegroups.com

I'm guessing this is IE.  I've run into this myself.  The only way to get IE to recognize XML is to have it retrieve that value as an attribute of the element, not as text of the element. 

-Chris

steven.yetter

unread,
Sep 10, 2011, 4:42:54 AM9/10/11
to selenesse-users
I think I also saw xml run togehter as text in Firefox but I cant
swear to it because my HTML test harness no longer works in firefox.
I think I saw it in Selenium too. I am running Selenium 2.0.

My fix for IE is to change my HTML test harness to display the xml
(change the TEXTAREA value) as XML escape sequences. < is &lt;.> is
&gt;. and & is &amp.
It's not very readable for the HTML test harness running outside of
Selenesse but it work for Selenesse. Javascript str.replace
accomplishes the change.



On Sep 7, 4:33 pm, Chris McMahon <christopher.mcma...@gmail.com>
wrote:
> I'm guessing this is IE.  I've run into this myself.  The only way to get IE
> to recognize XML is to have it retrieve that value as an attribute of the
> element, not as text of the element.
>
> -Chris
>
> > the variable from being interpreted as HTML.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages