I’m trying to measure the time it takes to render the next page after submitting some data. To get the timing, what I’m doing is:
Clicking the Submit button
Starting the timer
Waiting for the Expected Condition (presence of element available on the next page).
Subtract the start time from the current time.
My code is:
start = System.currentTimeMillis()
new WebDriverWait(driver, 15).until(ExpectedConditions.presenceOfElementLocated(By.id(“order_id”)));
System.out.println((System.currentTimeMillis() - start) + “ Order submission time");
Questions- Is my time calculation logic correct? Also, is my “wait” line the right trigger to stop the time calculation?
When I run this test via Appium I’m getting response times of around 3 seconds, but whenever I eyeball the response time, it takes about half that time so I’m thinking that maybe I’m not coding this right. I’m running this test on an attached Android device so is it possible the USB connectivity is slowing the response times?