Nir*_*tel 7 javascript selenium xpath selenium-rc
我使用Selenium RC与IE 6和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");
}
Run Code Online (Sandbox Code Playgroud)
这导致XPath定位器的速度提高,但改进不一致.在某些运行中,定位器所用的时间减半; 而有时它随机高.
我在这里错过了任何配置步骤吗?如果能够取得成功的人能够分享他们的观点和方法,那将会很棒.
谢谢,Nirmal
解:
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.useXpathLibrary("javascript-xpath");
}
Run Code Online (Sandbox Code Playgroud)
我自己实现了这个,我只需要执行 selenium.useXpathLibrary("javascript-xpath") 。在我的测试中,javascript xpath 在 IE 8 上大约快了 7 倍。还没有在其他任何东西上进行过真正的测试,但我们只将它用于 IE。
| 归档时间: |
|
| 查看次数: |
6324 次 |
| 最近记录: |