Why this code doesn\'t work?
import org.junit.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class MainTe
The error says it all :
java.lang.NoClassDefFoundError: com/google/common/base/Function
at MainTest.openGoogle(MainTest.java:15)
While working with Selenium v3.x you have to download geckodriver.exe from mozilla/geckodriver and place it in your system. Next you have to set the system property through the line System.setProperty()
as follows and provide the absolute path of the GeckoDriver binary within your system as follows :
@Before
public void openGoogle()
{
System.setProperty("webdriver.gecko.driver", "C:\\path\\to\\geckodriver.exe");
wd = new FirefoxDriver();
urll = "https://google.com";
}
Finally Instead of mentioning import org.junit.*;
as per best practices mention the distinct exports as follows :
Here you can find a detailed discussion on NoClassDefFoundError