Tyler,
What I've done in the past is to create a new method, Element#html=
which allows you to replace the outerHTML for any element:
class Watir::Element
def html=(new_html)
assert_exists
@o.outerHTML = new_html
end
end
Unfortunately, when playing with your top level document that contains
the frameset there wasn't any Watir::Element I could grab. I tried
doing it manually by taking different document elements on that top page
and trying to do the change like:
ie.document.body.outerhtml = "<BODY>test</BODY>"
Even though e.document.body.ole_put_methods shows that we should be able
to do this (an outerHTML put call exists) when tried I got the following
error:
irb(main):029:0> ie.document.body.outerhtml = "<BODY>test</BODY>"
WIN32OLERuntimeError:
OLE error code:800A0258 in htmlfile
<No Description>
HRESULT error code:0x80020009
Exception occurred.
from (irb):29:in `method_missing'
from (irb):29
So in Tyler's case, I was unable to find a way to change the frame
element in his top HTML. However, I often use this replacement
technique to prevent popups by changing the HTML attributes like this:
ie.text_field(:id, 'xxx').html = ie.text_field(:id, 'xxx').html.sub(/
onclick=\S+/, '')
which clears out the onclick=... from the element.
David
Bret Pettichord wrote:
> On 6/1/06, *Tyler Prete* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Well I may not even have to deal with it anymore, but how would I
> change this manually? I do not have control over the HTML in the
> page, I am only interacting with it via Watir.
>
>
> By design, Watir is a tool for automating things that you can do
> manually. If you don't know how to do it manually, then Watir is
> probably the wrong tool for you.
>
> Bret
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general