[Wtr-general] Saving HTML to output adds extra line feeds?

Paul Carvalho tester.paul at gmail.com
Fri Apr 21 11:00:02 EDT 2006


I just wrote a routine that will save the html output to a file if a "Server
Error" should appear on a page.  I noticed something odd when I examine the
TXT file though - it looks like there are line feed characters at the end of
each line.  Depending on the application I use to view the TXT file, I will
see either a control character 'square' at the end of each line, or the
output looks double spaced.

Does anyone know how I can save the html output without these extra line
feed characters?  I am using Watir 1.4.1.

Here is the calling script code:
---
      if ie.contains_text('Server Error')
          create_exception_report( ie.html )
      end
---

Here is a snippet of the method code that writes the output:
---
  def create_exception_report( html_content )
      # A nasty Server Error has occurred.  Open a file to capture the
results:
      f_e =  File.new(filename,  "w")
[snip]
      f_e.puts '=> ERROR DETAILS:'
      f_e.puts '-----------------'
      f_e.puts html_content   # <- ** line of interest **
      f_e.puts ''

      # Close the file
      f_e.close
  end
---

Here is a sample of the txt file output viewed in a text editor (not
NotePad):
---
=> ERROR DETAILS:
-----------------


<BODY bgColor=white><SPAN>

<H1>Server Error in '/ServerName' Application.

<HR width="100%" color=silver SIZE=1>

</H1>

---

What I was expecting:
---
=> ERROR DETAILS:
-----------------
<BODY bgColor=white><SPAN>
<H1>Server Error in '/ServerName' Application.
<HR width="100%" color=silver SIZE=1>
</H1>
---

Any Suggestions?  Is there an alternate command that I can use to write the
html output to file?  Perhaps I can scrub the html content to remove these
control characters?

Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060421/0db25206/attachment.html 


More information about the Wtr-general mailing list