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

来源:互联网 发布:南昌市网络教研平台 编辑:程序博客网 时间:2024/05/22 18:46

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

       例如:

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

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

0 0