如何获取硒中每个Page元素的加载时间或响应时间?
例如:我在UI中单击“确定”按钮,我需要知道此操作花费了多少时间(以毫秒为单位)
答案 0 :(得分:0)
using System.Diagnostics;
Stopwatch timer = new Stopwatch();
timer.Start();
driver.FindElement("ok button").Click();
timer.Stop();
Console.WriteLine(timer.ElapsedMilliseconds);
答案 1 :(得分:0)
如果您使用java
,则可以尝试以下逻辑:
long before = System.currentTimeMillis();
element.click()
long after = System.currentTimeMillis()-before;
System.out.println("elapsed time :" +after);