[Wtr-general] get the meta tag out of a page

Alien Ruby forum-watir-users at openqa.org
Fri Aug 25 20:45:13 EDT 2006


Thank you so much, Jeff.

This is the key, right here - ie.document.getElementsByTagName( "meta" ).item(i).outerHTML

I couldnt figure this out what function to use by myself, but now it's worked out very well.

But, my other question is why '...outerHTML.getContents' or '...outerHTML.getText' or some similar functions cant just spit out the value/content?


# I leave it to you to come up with good regular expressions for parsing
things out.

# these work but are overly greedy.
matches = body.scan( /name="(.+)"/ )
name = matches[1] || ""
matches = body.scan( /content="(.+)"/ )
content = matches[1] || ""
matches = body.scan( /http-equiv="{0,1}(.+)"{0,1}/ )
http_equiv = matches[1] || ""

http_equivs[http_equiv] = content if http_equiv != ""
metas[name] = content if name != ""
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=3625&messageID=10467#10467



More information about the Wtr-general mailing list