3

trying to run simple test selenium Web Driver program which is mentioned below:


package com.abc;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Mock_Exam {

    /**
     * @param args   
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.google.co.in/");

    }

}

after running as java application getting the below error :

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/JsonSyntaxException
    at org.openqa.selenium.firefox.Preferences.readDefaultPreferences(Preferences.java:95)
    at org.openqa.selenium.firefox.Preferences.<init>(Preferences.java:65)
    at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:87)
    at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:77)
    at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:66)
    at org.openqa.selenium.firefox.FirefoxDriver.getProfile(FirefoxDriver.java:262)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:239)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
    at com.kesdee.ia.Mock_Exam.main(Mock_Exam.java:14)
Caused by: java.lang.ClassNotFoundException: com.google.gson.JsonSyntaxException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 13 more

FireFox version: 36.0.1 Selenium: selenium-java-2.45.0

0

1 Answer 1

1

You miss the gson-<version>.jar: in your classpath. Download add add it.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Jens, Added the jar to build path and it is working now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.