[java.lang.NoClassDefFoundError:com / google / common / collect / ImmutableMap错误,使用GeckoDriver Firefox通过Java中的Selenium进行]] << [

问题描述 投票:0回答:1
我正在使用此代码,它给了我这个错误:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap at org.openqa.selenium.firefox.FirefoxDriver.<clinit>FirefoxDriver.java:108) at Selenium_1.main(Selenium_1.java:13) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 2 more

无法解决。我正在日食中工作,请你帮我一下。 

import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; //comment the above line and uncomment below line to use Chrome //import org.openqa.selenium.chrome.ChromeDriver; public class Selenium_1 { public static void main(String[] args) { // declaration and instantiation of objects/variables System.setProperty("webdriver.firefox.marionette","C:\\Program Files\\Java\\jre1.8.0_231\\lib\\ext\\geckodriver.exe"); //System.setProperty("webdriver.chrome.driver", "/path/to/chrome driver"); WebDriver driver = new FirefoxDriver(); //comment the above 2 lines and uncomment below 2 lines to use Chrome //System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe"); //WebDriver driver = new ChromeDriver(); String baseUrl = "http://demo.guru99.com/test/newtours/"; String expectedTitle = "Welcome: Mercury Tours"; String actualTitle = ""; // launch Fire fox and direct it to the Base URL driver.get(baseUrl); // get the actual value of the title actualTitle = driver.getTitle(); /* * compare the actual title of the page with the expected one and print * the result as "Passed" or "Failed" */ if (actualTitle.contentEquals(expectedTitle)){ System.out.println("Test Passed!"); } else { System.out.println("Test Failed"); } //close Fire fox driver.close(); } }

[如果您需要了解其他任何信息,请告诉我...我完全被困住了...帮助!救命!帮助!

[我正在使用此代码,它给我这个错误:线程“ main”中的异常java.lang.NoClassDefFoundError:org / openqa.selenium.firefox上的com / google / common / collect / ImmutableMap。...

java selenium guava noclassdeffounderror geckodriver
1个回答
0
投票
此错误消息...
© www.soinside.com 2019 - 2024. All rights reserved.