I created a method that takes a screenshot and then writes to an html file, inserting that screenshot into a table.
When I used Watir it worked fine (only really used IE browser).
Now I am using Watir-Webdriver and it takes the screenshots (on Firefox) and saves them just fine. However, when I write them to the html file they just show up on my html page as the little ripped paper icon.
This is my method:
def LogCapture(testID, passFail)
@passFail = passFail
@testID = testID
@time = Time.now.strftime("%m.%d.%Y %H.%M.%S")
@shotLoc = $FolderPath + "\\" + @passFail + @time + ".png"
$browser.screenshot.save @shotLoc
$fileHtml.puts"<TR><TD><@testID + " " + @passFail + " " + @time + "></TD></TR>"
$fileHtml.puts"<TR><TD><img src='" + @shotLoc + "'></TD></TR>"
$log.info(@passFail)
end
I know that the Watir-Webdriver screenshots capture the entire length of the page, unlike Watir, but I have no idea why the screenshots are failing to display on my html file/page.
Thanks y'all
*SOLUTION: got it to display in both FF and IE when writing to the html file I just had to include: "file:\\localhost\" before my file path.
Thanks Justin! Go Maple Leafs!