相关疑难解决方法(0)

在Selenium中计时页面加载时间

我正在使用selenium来记录我网站上的一些性能测试.例如登录时间,查询时间等.我在Selenium IDE上记录了一个示例脚本.我现在运行一个Selenium RC(java).

    public void testNew() throws Exception {
    selenium.open("/jira/secure/Dashboard.jspa");
    selenium.selectFrame("gadget-10371");
    selenium.type("login-form-username", "username");
    selenium.type("login-form-password", "pw");
    selenium.click("login");
    selenium.waitForPageToLoad("30000");
    selenium.selectWindow("null");
    selenium.click("find_link");
    selenium.waitForPageToLoad("30000");
    selenium.removeSelection("searcher-pid", "label=All projects");
}
Run Code Online (Sandbox Code Playgroud)

如何记录从单击登录按钮到加载"登录"屏幕的时间长度?

这是我想出的,这是一个准确的时机吗?:

    long starttime = System.currentTimeMillis();
    selenium.waitForPageToLoad("30000");
    long stoptime = System.currentTimeMillis();
    long logintime = stoptime -  starttime;
    System.out.println(logintime+" ms" );
Run Code Online (Sandbox Code Playgroud)

java performance logging selenium

6
推荐指数
1
解决办法
6455
查看次数

标签 统计

java ×1

logging ×1

performance ×1

selenium ×1