I am trying to program the load time of a list of websites. The goal is to roughly simulate the page load time that the user will perceive.
My first approach is to call inside a loop:
startTime = System.currentTimeMillis(); driver.get("http://" + url); diff = System.currentTimeMillis() - startTime; System.out.println("Load time was " + diff);
The problem is that sometimes I get the result of the time before the page actually loads (for example, I get 50 ms times), so I think that control is passed to the next command until driver.get() .
What should I do to improve this test?
EDIT:
As user1258245 suggested I wait for the item to load, but the problem is that I donβt know which pages will load in advance.
java selenium delay web-testing
cookM
source share