[Wtr-general] Saving HTML to output adds extra line feeds?
Attebery, Bill
Bill.Attebery at twtelecom.com
Fri Apr 21 12:54:47 EDT 2006
Sorry Paul -- I didn't read your code close enough -- please disregard
my response, I made a bad assumption.
_____
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Paul Carvalho
Sent: Friday, April 21, 2006 9:00 AM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] Saving HTML to output adds extra line feeds?
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.
The content contained in this electronic message is not intended to
constitute formation of a contract binding TWTC. TWTC will be
contractually bound only upon execution, by an authorized officer, of
a contract including agreed terms and conditions or by express
application of its tariffs.
This message is intended only for the use of the individual or entity
to which it is addressed. If the reader of this message is not the
intended recipient, or the employee or agent responsible for
delivering the message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
message is strictly prohibited. If you have received this
communication in error, please notify us immediately by replying to
the sender of this E-Mail or by telephone.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060421/b028963f/attachment.html
More information about the Wtr-general
mailing list