Exception in thread main java lang noclassdeffounderror com google common collect immutablemap

java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap error using GeckoDriver Firefox through Selenium in Java

Unable to solve it. I am working in eclipse, could you please help me out.

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(); > > 

Please let me know if you need to know anything else… i am totally stuck… HELP! HELP! HELP!

Читайте также:  Preg replace php wordpress

Solution

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap at org.openqa.selenium.firefox.FirefoxDriver 

…implies that the file com/google/common/collect/ImmutableMap might be corrupted or there is some incompatibility between the version of the binaries you are using specifically with the guava version / dependency (maven).

You need to take care of a couple of things as follows:

    In the System.setProperty() line you need to change webdriver.firefox.marionette to webdriver.gecko.driver . So effectively, the line of code will be:

System.setProperty("webdriver.gecko.driver","C:\\Program Files\\Java\\jre1.8.0_231\\lib\\ext\\geckodriver.exe"); 

Reference

You can find a relevant discussion in:

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Источник

java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap error using GeckoDriver Firefox through Selenium in Java

Unable to solve it. I am working in eclipse, could you please help me out.

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(); > > 

Please let me know if you need to know anything else… i am totally stuck… HELP! HELP! HELP!

Solution

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap at org.openqa.selenium.firefox.FirefoxDriver 

…implies that the file com/google/common/collect/ImmutableMap might be corrupted or there is some incompatibility between the version of the binaries you are using specifically with the guava version / dependency (maven).

You need to take care of a couple of things as follows:

    In the System.setProperty() line you need to change webdriver.firefox.marionette to webdriver.gecko.driver . So effectively, the line of code will be:

System.setProperty("webdriver.gecko.driver","C:\\Program Files\\Java\\jre1.8.0_231\\lib\\ext\\geckodriver.exe"); 

Reference

You can find a relevant discussion in:

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Источник

Exception in thread «main» java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap error using Selenium Java

enter image description here

Error snapshot:

Solution

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap 

…implies that the file com/google/common/collect/ImmutableMap might be corrupted or there is some incompatibility between the version of the binaries you are using.

Further you need to take care of a couple of things as follows:

    Instead of storing the chromedriver.exe binary right under C:\ try to put it within a directory as C:\\BrowserDrivers\\chromedriver.exe and change the System.setProperty() line accordingly. So effectively, the line of code will be:

System.setProperty("webdriver.gecko.driver","C:\\BrowserDrivers\\chromedriver.exe"); 
  • JDK is upgraded to current levels JDK 8u311.
  • Selenium is upgraded to current released Version 4.1.3.
  • ChromeDriver is updated to current ChromeDriver v100.0 level.
  • Chrome Browser is updated to current chrome=100.0 (as per chromedriver=100.0.4896.60 release notes).

Reference

You can find a relevant discussion in:

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Источник

Error when running script Exception in thread main java lang NoClassDefFoundError com google common collect ImmutableMap

  • All categories
  • ChatGPT (11)
  • Apache Kafka (84)
  • Apache Spark (596)
  • Azure (145)
  • Big Data Hadoop (1,907)
  • Blockchain (1,673)
  • C# (141)
  • C++ (271)
  • Career Counselling (1,060)
  • Cloud Computing (3,469)
  • Cyber Security & Ethical Hacking (162)
  • Data Analytics (1,266)
  • Database (855)
  • Data Science (76)
  • DevOps & Agile (3,608)
  • Digital Marketing (111)
  • Events & Trending Topics (28)
  • IoT (Internet of Things) (387)
  • Java (1,247)
  • Kotlin (8)
  • Linux Administration (389)
  • Machine Learning (337)
  • MicroStrategy (6)
  • PMP (423)
  • Power BI (516)
  • Python (3,193)
  • RPA (650)
  • SalesForce (92)
  • Selenium (1,569)
  • Software Testing (56)
  • Tableau (608)
  • Talend (73)
  • TypeSript (124)
  • Web Development (3,002)
  • Ask us Anything! (66)
  • Others (2,231)
  • Mobile Development (395)
  • UI UX Design (24)

Join the world’s most active Tech Community!

Welcome back to the World’s most active Tech Community!

Subscribe to our Newsletter, and get personalized recommendations.

GoogleSign up with Google facebookSignup with Facebook

Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

  • DevOps Certification Training
  • AWS Architect Certification Training
  • Big Data Hadoop Certification Training
  • Tableau Training & Certification
  • Python Certification Training for Data Science
  • Selenium Certification Training
  • PMP® Certification Exam Training
  • Robotic Process Automation Training using UiPath
  • Apache Spark and Scala Certification Training
  • Microsoft Power BI Training
  • Online Java Course and Training
  • Python Certification Course
  • Data Scientist Masters Program
  • DevOps Engineer Masters Program
  • Cloud Architect Masters Program
  • Big Data Architect Masters Program
  • Machine Learning Engineer Masters Program
  • Full Stack Web Developer Masters Program
  • Business Intelligence Masters Program
  • Data Analyst Masters Program
  • Test Automation Engineer Masters Program
  • Post-Graduate Program in Artificial Intelligence & Machine Learning
  • Post-Graduate Program in Big Data Engineering

COMPANY

WORK WITH US

DOWNLOAD APP

appleplaystore googleplaystore

CATEGORIES

CATEGORIES

  • Cloud Computing
  • DevOps
  • Big Data
  • Data Science
  • BI and Visualization
  • Programming & Frameworks
  • Software Testing © 2023 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved. Terms & ConditionsLegal & Privacy

Источник

Оцените статью