Exception when running the tests
srinidhi82 opened this issue · 10 comments
Hi,
I did clone your Selenium Maven Template, however if i run the following command i am getting an exception
Command ran : mvn verify -Pselenium-tests
Exceptions seen:
xception in thread "pool-1-thread-2" java.lang.NoSuchMethodError: org.openqa.selenium.io.IOUtils.closeQuietly(Ljava/io/Closeable;)V
at org.openqa.selenium.firefox.FirefoxProfile.updateUserPrefs(FirefoxProfile.java:333)
at org.openqa.selenium.firefox.FirefoxProfile.layoutOnDisk(FirefoxProfile.java:450)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:77)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:188)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:183)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:100)
at com.lazerycode.selenium.SeleniumBase.loadWebDriver(SeleniumBase.java:140)
at com.lazerycode.selenium.SeleniumBase.access$000(SeleniumBase.java:20)
at com.lazerycode.selenium.SeleniumBase$1.initialValue(SeleniumBase.java:29)
at com.lazerycode.selenium.SeleniumBase$1.initialValue(SeleniumBase.java:25)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:141)
at java.lang.ThreadLocal.get(ThreadLocal.java:131)
at com.lazerycode.selenium.SeleniumBase.getDriver(SeleniumBase.java:56)
at com.lazerycode.selenium.ScreenshotListener.onTestFailure(ScreenshotListener.java:27)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1895)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1879)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1292)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Can you please let me know how do i fix this issue, also is there a way i can run the tests directly from my eclipse like run as maven test ?
Thanks
Srinidhi
What version of Java are you using?
Which OS?
Hi Mark,
I am running the framework on Mac OSX and the Java version is java version "1.6.0_41" , all i did was cloned your project and created the project in eclipse and ran through the steps you has mentioned. Please do let me know if i am going wrong in executing the tests
Cheers
Sri
Right, I can reproduce on a Mac. I'll look into it and update this as soon as I have a fix.
I see the same behavior using Java 1.7.0_10 on a Mac. Just wanted to confirm that this isn't Java version dependent. Thanks for looking into it!
Rolled back to 2.30.0 for now which fixes this issue in OSX. Not quite sure what's going on yet, it needs more investigation...
Replace the dependencies of the pom.xml with this and it now works:
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.35.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>1.5</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.detro.ghostdriver</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.30</version>
<scope>test</scope>
</dependency>
</dependencies>
Hmm missing dependency somewhere maybe?
I did find that the second test often failed on Firefox as it was using the same browser instance as the first test and searched for "cheese!milk!" instead of just "milk!"
Your Before/After methods only create a new webdriver between suites of tests, not individual test methods. Is this legit?
Sent from my iPhone
On Sep 18, 2013, at 1:42 AM, "Mark Collin" notifications@github.com wrote:
Hmm missing dependency somewhere maybe?
—
Reply to this email directly or view it on GitHub.
Thanks Timu2007,
I just added one more firefox dependency to your given dependency, and now its working with firefox :) ........
org.seleniumhq.selenium selenium-firefox-driver 2.35.0Right i'm not seeing issues with firefox driver. the dependencies all seem to be coming down correctly here.
@timu2007 yes that is be design, you can make the browser close every time by adding a driver.quit() to the @AfterMethod if you want a clean browser every time. The test has been tweaked slightly to make sure it clears the textbox before entering text to make sure the error you are seeing doesn't occur any more.