From: Marc G. <mgu...@ya...> - 2011-02-23 09:00:10
|
Hi Steve, I'm not sure to fully understand you. If you can formulate it as unit test, it would really help. Cheers, Marc. -- HtmlUnit support & consulting from the source Blog: http://mguillem.wordpress.com Le 20/02/2011 04:18, Steve Labarbera a écrit : > I wanted to also add that adding a break point and looking at the HtmlPage Dom after adding the following url: http://someurl.com?var=<a%20href=""%20%20onmouseover=prompt()>pp</a> calling > List<HtmlAnchor> vv = ((HtmlPage) page).getAnchors(); shows the anchor as<a>? > > You can see that links already in the response look fine. Its the last anchor which was added by an innerHTML assignment that has none of its attributes collected. I'm not sure if this is an expected > outcome. > > [HtmlAnchor[<a href="http://www.url.com" id="link1" onmouseover="changeMe()">], HtmlAnchor[<a href="http://www.yahoo.com" id="link2">], HtmlAnchor[<a href="http://www.yahoo.com" id="link3" onmouseover="post_to_url('/', 'bad=bad', 'post') ">], HtmlAnchor[<a>]] > > Anyone have any incite on this and maybe how to work around this? I was hoping I could traverse the DOM myself to create the response but this data shows that might not be possible. > ________________________________________ > From: Steve Labarbera [ste...@wh...] > Sent: Saturday, February 19, 2011 4:37 PM > To: htm...@li... > Subject: [Htmlunit-user] asXM() leaves out attributes from generated response? > > I have a problem with the asXML() function omitting attributes from the generated response. As an example pulling the URL into an innerHTML like so: > > http://someurl.com?var=<p%20onmouseover=prompt()>pp</p> > > The page javascript does the following just add the url to the page inside a div using innerHTML: > > <script> > > var theText = document.getElementById('add'); > theText.innerHTML = document.URL; > > > </script> > > However, when printing the DOM using asXML() you get the following: > > > <div id="add"> > http://someurl.com?var= > <p> > pp > </p> > </div> > > You can see it omits all attributes in the<p> tag? > > After running the DOM it is important that those attributes still exist because I run a match for them. I was curious if this is a bug when parsing the XML or is there something i'm overlooking? I checked the bugs table and ran a search on asXML and did not see this as an issue? > > > Thanks, > > Steve |