Tests Don't Work
jrmich44 opened this issue · 7 comments
None of these tests work. Getting the below error running them
java.lang.NoClassDefFoundError: com/typesafe/config/ConfigFactory
at io.github.bonigarcia.wdm.WdmConfig.(WdmConfig.java:37)
at io.github.bonigarcia.wdm.WdmConfig.getInstance(WdmConfig.java:43)
at io.github.bonigarcia.wdm.WdmConfig.getString(WdmConfig.java:51)
at io.github.bonigarcia.wdm.BrowserManager.getDriverVersion(BrowserManager.java:99)
at io.github.bonigarcia.wdm.BrowserManager.setup(BrowserManager.java:659)
at io.github.bonigarcia.wdm.test.PhatomJsTest.setupClass(PhatomJsTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: com.typesafe.config.ConfigFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 21 more
I have just executed the tests in my machine (master branch) and this error is not happening to me. Which version of Java are you using?
I'm not able to reproduce that error.
I have created javaproject added webdrivermanager to the project and webdriver jars.
created simple java class with main() -->run as javaApplication throws below error
Code is here:
package samplePrograms;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import io.github.bonigarcia.wdm.WebDriverManager;
public class YahooSearchFirefoxTest {
public static void main(String[] args) throws InterruptedException {
// set the geckodriver.exe path
//System.setProperty("webdriver.gecko.driver", "D:\\BrowserExefiles\\geckodriver-v0.26.0-win64\\geckodriver.exe");
WebDriverManager.firefoxdriver().setup();
//interface refvar=new implementingclass();
WebDriver driver=new FirefoxDriver();
//Open yahoo.com
driver.get("https://yahoo.com");
//maximize the window
driver.manage().window().maximize();
//add implicit wait
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//create WebDriverWait object
WebDriverWait wait=new WebDriverWait(driver,30);
//call the browser methods
String t=driver.getTitle();
System.out.println("current page page title is-->"+t);
//fetch the current page absolute url
String absurl=driver.getCurrentUrl();
System.out.println("current page absolute url is-->"+absurl);
//fetch the current page sourece code
String src=driver.getPageSource();
//fetch the current page widnow id
String pid=driver.getWindowHandle();
System.out.println("Current page window id-->"+pid);
//verify the page title
wait.until(ExpectedConditions.titleIs("Yahoo India | News, Finance, Cricket, Lifestyle and Entertainment"));
//type the selenium keyword in search editbox
driver.findElement(By.id("uh-search-box")).sendKeys("selenium");
//click on the search button
driver.findElement(By.cssSelector("button[type='submit'][id='uh-search-button']")).submit();
//wait and verify the page title - selenium - Yahoo India Search Results
wait.until(ExpectedConditions.titleContains("selenium - Yahoo India Search Results"));
//fetch the results text
String txt=driver.findElement(By.xpath("//a[@class='next']/following::span")).getText();
System.out.println("search results text is--> "+txt);
//txt="19,800,000 results";
//use the split()
String[] str=txt.split(" ");
//str[]=["19,800,000","results"]
// 0 1
System.out.println("results count is-->"+str[0]);
Thread.sleep(3000);
//close the browser
driver.close();
}
}
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpRequestBase
at samplePrograms.YahooSearchFirefoxTest.main(YahooSearchFirefoxTest.java:20)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpRequestBase
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
It Works fine with maven project but not working with java project i am using JDK 8
Hi,
I'm getting the exception, I.E..,
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hc/core5/http/ClassicHttpRequest
at Test.main(Test.java:11)
Caused by: java.lang.ClassNotFoundException: org.apache.hc.core5.http.ClassicHttpRequest
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)
... 1 more
Eventhough, I've removed test from my dependency.. How to resolve this issue.?
@bonigarcia can u pls resolve my issue?