我正在使用Selenium RC与IE 6和XPath定位器是非常可怕的
慢.
所以我试图看看 javascript-xpath是否真的能加快速度.
慢.
所以我试图看看 javascript-xpath是否真的能加快速度.
但是找不到关于如何使用原生x-的足够/清晰的文档
路径库.
我正在做以下事情:
- protected void startSelenium (String testServer,String appName,String testInBrowser){
- selenium = new DefaultSelenium("localhost",4444,"*" +testInBrowser,testServer+ "/"+ appName + "/");
- echo("selenium instance created:"+selenium.getClass());
- selenium.start();
- echo("selenium instance started..." + testServer + "/" + appName +"/");
- selenium.runScript("lib/javascript-xpath-latest-cmp.js");
- selenium.useXpathLibrary("javascript-xpath");
- selenium.allowNativeXpath("true");
- }
这导致XPath定位器的速度提高但是
改进不一致.在某些运行中,所需的时间
定位器减半;而有时它随机高.
我在这里错过了任何配置步骤吗?如果有人会很棒
谁取得了成功,可以分享他们的观点和方法.
谢谢,
尼尔默尔
解:
- protected void startSelenium (String testServer,testServer+ "/"+ appName + "/");
- echo("selenium instance created:"+selenium.getClass());
- selenium.start();
- echo("selenium instance started..." + testServer + "/" + appName +"/");
- selenium.useXpathLibrary("javascript-xpath");
- }
解决方法
我自己实现了这个,我只需要做selenium.useXpathLibrary(“javascript-xpath”).在我的测试中,javascript xpath在IE 8上快了大约7倍.还没有真正测试过任何其他内容,但我们只将它用于IE.