在ie上使用xpath时selenium运行缓慢

除了ie,其他主要浏览器都是内置对xpath的支持的,但ie不行,所以selenium
  使用了javascript库,默认使用的是ajaxslt,所以会很慢。解决办法是更换默认的xpath版本库,使用javascript-xpath

       例如:

       selenium = new DefaultSelenium(location, port, browser, targetPath);   
        selenium.start();   
        selenium.useXpathLibrary("javascript-xpath");  

 另外,写xpath时尽量从一个具有id的元素开始,这样也可以大大提高执行速度

posted on 2011-04-14 11:22  张飞_  阅读(1986)  评论(2编辑  收藏  举报

导航