selenium.JavascriptException: javascript error: Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite

后端 未结 7 3000
花落未央
花落未央 2021-02-20 12:40

using chrome 78 and chromedriver78 When i click an audio file or try to stop an audio using selenium tests i am getting this error.

Error:

org.openqa.selen         


        
7条回答
  •  爱一瞬间的悲伤
    2021-02-20 13:31

    I experienced this same issue while trying to click a cell in an AngularJS grid. I confirmed that my XPath query resulted in only one result, and then explored if adding in a Wait Condition would help. As it turned out, adding in a Wait here allowed the code to continue without error.

    The below code is the method I used to click the cell. I switched from Click() to an Action as the Click() method was being intercepted by a different element.

    public void ClickEmploymentChangeLogButton()
    {
        Wait.Until(WaitConditions.ElementIsVisibleAndEnabled(EmploymentChangeLogButton));
        Actions actions = new Actions(driver);
        actions.MoveToElement(EmploymentChangeLogButton).Perform();
        actions.MoveToElement(EmploymentChangeLogButton).Click().Perform();
    }
    

    WaitConditions is a separate class to model some of the behaviour of the deprecated ExpectedConditions package.

    Here's the method inside WaitConditions that is used above.

    public static Func ElementIsVisibleAndEnabled(IWebElement element)
    {
        return (driver) =>
        {
            try
            {
                return element.Displayed && element.Enabled;
            }
            catch (Exception)
            {
                // If element is null, stale or if it cannot be located
                return false;
            }
        };
    }
    

提交回复
热议问题