IE中的Javascript性能问题

时间:2016-12-12 05:20:36

标签: javascript c# selenium internet-explorer selenium-webdriver

pavascript的PFB功能。它在Chrome中表现不错。但IE的性能非常差。如果功能在Chrome中耗时4ms,在IE中需要170ms。有人请帮帮我。 确定问题不是因为Javascript。这是因为来自webdriver的ExecuteScript 在这种情况下,有没有办法提高IE的性能?

 public string OnMouseMoveListner()
{
    string onMouseMove = @"  
    function OnMouseMove (event) 
    {
    window.onEscape=null;                                 
    window.isRefresh='set';
    var posX = event.clientX, posY = event.clientY;
    // displays the coordinates used for the elementFromPoint method                  
    // get the element that is located under the mouse                          y
    var overElem = document.elementFromPoint (posX, posY);
    if (overElem && overElem.tagName === undefined) 
    {   // in case of text nodes (Opera)
        overElem = overElem.parentNode; // the parent node will be selected
        window.control= overElem ;
    }                                                                      
    // the body and the html tag won't be selected
    if (overElem && overElem.tagName.toLowerCase () !='body' && overElem.tagName.toLowerCase () != 'html') 
    {                                 
        window.control= overElem ;                                   
    }  
    window.outerHeight=window.outerHeight;
    window.innerHeight=window.innerHeight;                                  
    }
    window.isRefresh='set';
    ";
    return onMouseMove;
}


  ((IJavaScriptExecutor)webDriver).ExecuteScript(js.OnMouseMoveListner());

0 个答案:

没有答案