0

How to get each Page element load time or response time in selenium?

eg: i was clicking on Ok Button in UI i need to know how much time it was taking for this operation in milliseconds

siva kumar
  • 31
  • 3

2 Answers2

0
using System.Diagnostics;
Stopwatch timer = new Stopwatch();
timer.Start();
driver.FindElement("ok button").Click();
timer.Stop();
Console.WriteLine(timer.ElapsedMilliseconds);
Somber
  • 433
  • 1
  • 3
  • 12
  • 5
    Why should the OP "try this"? It's normaly considered good form to explain your suggestions/answers. Code only answers can be surprisingly uninformative, even if they are technically correct. A **good answer** will always have an explanation of what was done and why it was done that way, not only for the OP but for future visitors to SO that may find this question and be reading your answer. – Maximilian Ast Aug 29 '19 at 07:52
0

If you use java, you can try this logic:

long before = System.currentTimeMillis();
element.click()
long after = System.currentTimeMillis()-before;
System.out.println("elapsed time :" +after);
frianH
  • 7,295
  • 6
  • 20
  • 45