I have this code:
ie1.link(:text, /Exception:/)
It is producing an error message which I want include to my report. I use the following method to create reports – http://wiki.openqa.org/display/WTR/HTML+report+class.
The output of each step in the test is described in this line:
def addtoReport(reportName, step, result, description)
The description’s type is string. I write this code:
h = ie1.link(:text, /Exception:/)
r.addtoReport(testReport, "check insert", "FAILED", h )
But I get the error:
E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/CLReport.rb:150:in `+': can't convert Watir::Link into String (TypeError)
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/CLReport.rb:150:in `addtoReport'
from file.rb:96:in `<main>'
Assuming you want the text of the link, you should be using
h.text.So either state you want the text attribute of h:
or save the text as h: