使用Java/Selenium-正在运行多少动画

使用Java/Selenium-正在运行多少动画,java,selenium,css-selectors,Java,Selenium,Css Selectors,我想知道有多少动画在一个网站上运行。但是我的selenium代码抛出了一个InvalidSelectorException driver.findElements(By.cssSelector(":animated")).length() 如何正确获取Java/Selenium中运行的动画数量?伪类:animated特定于JQuery库,不是有效的CSS选择器 如果希望使用它,请确保页面加载JQuery并使用executeScript执行代码: int count = (int)((Javas

我想知道有多少动画在一个网站上运行。但是我的selenium代码抛出了一个InvalidSelectorException

driver.findElements(By.cssSelector(":animated")).length()

如何正确获取Java/Selenium中运行的动画数量?

伪类
:animated
特定于JQuery库,不是有效的CSS选择器

如果希望使用它,请确保页面加载JQuery并使用
executeScript
执行代码:

int count = (int)((JavascriptExecutor)driver).executeScript(
    "return $(':animated').length;");

我刚刚在这个博客上看到了这个方法,有些曲折。。。