Java 我一直在尝试在intelliJ中运行selenium basic测试,但出现以下错误

Java 我一直在尝试在intelliJ中运行selenium basic测试,但出现以下错误,java,maven,selenium,intellij-idea,Java,Maven,Selenium,Intellij Idea,Java.lang.IllegalAccessError:尝试访问类 类中的org.openqa.selenium.os.ExecutableFinder org.openqa.selenium.firefox.FirefoxBinary 在 org.openqa.selenium.firefox.FirefoxBinary.locatefirefoxbinariesfromformplatform(FirefoxBinary.java:433) 在 org.openqa.selenium.fi

Java.lang.IllegalAccessError:尝试访问类 类中的org.openqa.selenium.os.ExecutableFinder org.openqa.selenium.firefox.FirefoxBinary

在 org.openqa.selenium.firefox.FirefoxBinary.locatefirefoxbinariesfromformplatform(FirefoxBinary.java:433) 在 org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:108) 在 FirefoxDriver.java:122 在 com.masteringselenium.BasicTest.google搜索的示例(BasicTest.java:21) 在 com.masteringselenium.BasicTest.googlecheese示例(BasicTest.java:43) 位于的sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 位于java.lang.reflect.Method.invoke(Method.java:498) org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) 位于org.testng.internal.Invoker.invokeMethod(Invoker.java:714) org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)位于 org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)位于 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) 在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) 位于org.testng.TestRunner.privateRun(TestRunner.java:767) org.testng.TestRunner.run(TestRunner.java:617)位于 org.testng.SuiteRunner.runTest(SuiteRunner.java:334)位于 org.testng.SuiteRunner.runsequential(SuiteRunner.java:329)位于 org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)位于 org.testng.SuiteRunner.run(SuiteRunner.java:240)位于 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)位于 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)位于 org.testng.testng.runSuitesSequentially(testng.java:1198)位于 org.testng.testng.runSuitesLocal(testng.java:1123)位于 org.testng.testng.run(testng.java:1031)位于 org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)位于 org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)位于 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)位于 invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 位于java.lang.reflect.Method.invoke(Method.java:498) com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)


根据正在运行的Selenium版本,在实例化Firefox驱动程序时,可能需要指定Firefox二进制文件的路径。例如,使用Selenium 2.53.1的外观如下:

FirefoxBinary ffBinary = new FirefoxBinary(new File("path to your firefox.exe"));
FirefoxProfile ffProfile = new FirefoxProfile();
driver = new FirefoxDriver(ffBinary,ffProfile);
请阅读并编辑带有明确问题的问题。