Q. How can extract information from script headers?

A. Use the getElementsByTagName method and iterate through results …
Example html:

<title>test_0016</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="koops">
<!-- Date: 2008-08-12 -->
<script type="text/javascript">var PAGE_TID ="cache;app05.qa.sfo1:8101;2008-08-07T18:38:30Z;0001";
</script>

Example watir:

@b.goto('http://justaddwatir.com/watir/test_html/tc_0001_0100/test_0016.html')
s=[]
scripts = @b.document.body.parentElement.getElementsByTagName("script")
scripts.each do |script_tag|
  script_tag.invoke("innerHTML").each do |script|
    if script.match(/var PAGE_TID/)
      puts script
    end
  end
end
Read More