Java selenium webdriver中的Click()操作不适用于firefox 下面的代码不适用于单击操作

Java selenium webdriver中的Click()操作不适用于firefox 下面的代码不适用于单击操作,java,selenium-webdriver,Java,Selenium Webdriver,我在chrome上试过,但在Firefox上没有 package SeleniumCase; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class Seleniu

我在chrome上试过,但在Firefox上没有

    package SeleniumCase;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class SeleniumClass {
    public static void main(String[] args) 

     {

       WebDriver driver;
       System.setProperty("webdriver.gecko.driver","E:\\Librar\\geckodriver.exe");
       driver = new FirefoxDriver();
       driver.get("my company url hide for security reason");
       driver.findElement(By.id("UserName")).sendKeys("admin@school.com");
       driver.findElement(By.id("next")).click();
       driver.findElement(By.id("Password")).sendKeys("passw0rd");
       driver.findElement(By.id("submit")).click();         
     } 
}

您是否收到任何错误?请共享异常或错误

试试这个

JavascriptExecutor js = (JavascriptExecutor) driver;
            js.executeScript("var evt = document.createEvent('MouseEvents');" + "evt.initMouseEvent('click',true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,null);" + "arguments[0].dispatchEvent(evt);",  webElement);

试试这段代码,它在C#
IJavaScriptExecutor js=(IJavaScriptExecutor)驱动程序中;js.ExecuteScript(“参数[0]。单击();”,元素)您是否遇到异常?