package selenium_examples;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class Test{
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter("E:\\test.txt"));
bw.write("Helloooo");
bw.newLine();
bw.write("This is a new line");
bw.newLine();
bw.write("One more new line");
bw.close();
System.out.println("Done!");
}
}
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class Test{
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter("E:\\test.txt"));
bw.write("Helloooo");
bw.newLine();
bw.write("This is a new line");
bw.newLine();
bw.write("One more new line");
bw.close();
System.out.println("Done!");
}
}
Script 2:-
package selenium_examples;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test {
public static void main(String[] args) throws IOException {
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com");
String s=driver.getTitle();
BufferedWriter bw = new BufferedWriter(new FileWriter("E:\\test1.txt"));
bw.write(s);
bw.close();
System.out.println("Done!");
}
}