This is probably a java noob question, but here is my script:
- Using selenium, I grabbed the html source using getBodyText ()
- using java, I want to save the information from getBodyText () into an html file, so that I can view it later
I currently have getBodyText (), which is stored as a string, here is the code:
String stored_report = selenium.getBodyText();
File f = new File("C:/folder/" + "report" + ".html");
FileWriter writer = new FileWriter(f);
writer.append(stored_report);
System.out.println("Report Created is in Location : " + f.getAbsolutePath())
writer.close();
Do I need to use FileReader? What do I need to do so that the saved html file still displays the html format? (currently, since it is stored as a string, the page is displayed with everything that is displayed on one line)
Thanks in advance!
source
share