I'm writing a java code to do the loading test using selenium. I have a text file which contains the urls of websites i'm using for the test. I want my app to read the text file and display the loading time for each url in the text file. How can i do it?
This code is for two websites but how can i read a text file which includes several websites and get the loading times.
package webauto;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WebAuto {
public static void main(String[] args) {
WebDriver firefoxDriver=new FirefoxDriver();
long start = System.currentTimeMillis();
firefoxDriver.get("http://www.google.com");
long finish = System.currentTimeMillis();
long totalTime = finish - start;
System.out.println("Total Time for page load - "+(totalTime/1000)+"s");
long start1 = System.currentTimeMillis();
firefoxDriver.get("http://www.ebay.com");
long finish1 = System.currentTimeMillis();
long totalTime1 = finish1 - start1;
System.out.println("Total Time for page load - "+(totalTime1/1000)+"s");
}
}