[Webtest] Help needed: Encoding Bug in Webtest/underlying library?

Peter Hoepfl Peter Hoepfl" <Hoepfl@atrada.net
Mon, 18 Aug 2008 12:49:32 +0200


Hello,

this is my first post to this list, I hope I'm doing this correct.

We have a problem with &quot; getting decoded twice in certain =
javascript code when invoked from Webtest.
I managed to write a simple testcode that shows my problem, here is my =
testcode:

<html>
<body>
<a href=3D"#" title=3D"mytest" =
onclick=3D"javascript:document.getElementById(&quot;test&quot;).innerHTML=
 =3D document.getElementById(&quot;async&quot;).innerHTML;">do =
something</a>
<div id=3D"test">
huh
</div>
<div id=3D"async">
<a href=3D"#" title=3D"test2" =
onclick=3D"javascript:document.getElementById(&quot;testoutput&quot;).inn=
erHTML =3D &quot;hello&quot;">do something more</a>
</div>
<div id=3D"testoutput">
</div>
</body>
</html>

When I run this webtest :
			<invoke url=3D"/test.htm"/>
			<clickElement xpath=3D"//a[@title=3D'mytest']"/>

The resulting page looks like this:
<html>
  <head/>
  <body>
    <a href=3D"#" title=3D"mytest" =
onclick=3D"javascript:document.getElementById(&quot;test&quot;).innerHTML=
 =3D document.getElementById(&quot;async&quot;).innerHTML;">
      do something
    </a>
    <div id=3D"test">
      <a href=3D"#" title=3D"test2" =
onclick=3D"javascript:document.getElementById(" testoutput=3D"">
        do something more
      </a>
    </div>
    <div id=3D"async">
      <a href=3D"#" title=3D"test2" =
onclick=3D"javascript:document.getElementById(&quot;testoutput&quot;).inn=
erHTML =3D &quot;hello&quot;">
        do something more
      </a>
    </div>
    <div id=3D"testoutput">
    </div>
  </body>
</html>

As you can see the &quot; gets decoded although it shouldn't leading to =
a broken javascript code in the test-div.
When I perform the click in a regular browser the code is correct.
To check simply save the code above to a file perfom the click in a =
regular browser.

Any idea what goes wrong?


Best Regards,

Peter H=F6pfl