Java FirefoxDriver无法转换为HasInputDevices

Java FirefoxDriver无法转换为HasInputDevices,java,firefox,selenium,selenium-webdriver,Java,Firefox,Selenium,Selenium Webdriver,我正在使用selenium FirefoxDriver。我想在html页面上拖放一些元素,因此我使用: Actions actions = new Actions(firefoxDriver) 但我有一个例外: java.lang.ClassCastException: 无法将org.openqa.selenium.firefox.FirefoxDriver强制转换为 org.openqa.selenium.interactions.HasInputDevices 有什么想法吗?你是如何定义f

我正在使用selenium FirefoxDriver。我想在html页面上拖放一些元素,因此我使用:

Actions actions = new Actions(firefoxDriver)
但我有一个例外:

java.lang.ClassCastException: 无法将org.openqa.selenium.firefox.FirefoxDriver强制转换为 org.openqa.selenium.interactions.HasInputDevices


有什么想法吗?

你是如何定义firefoxDriver的?另外,显示操作导入行。WebDriver firefoxDriver=new firefoxDriver。。。Actions builder=新的ActionswebDriver;动作dragAndDrop=builder.clickAndHoldfrom.moveToElementto.releaseto.build;dragAndDrop.perform;导入org.openqa.selenium.interactions.Action;导入org.openqa.selenium.interactions.Actions;您使用的是什么版本的selenium和firefox?试试这两种最新的。