Hello All,
Yesterday I successfully setup Eclipse to run my Selenium tests; however I’m getting the following error when I try to run my initial test. Can you please help me understand the error?
I created a simple login test using Selenium IDE 1.5.0 and formatted the test case into Junit4 (RC) and copied that into Eclipse.
Failure Trace
junit.framework.AssertionFailedError: Exception in constructor: testSignin (java.lang.Error: Unresolved compilation problem:
Syntax error on token "com", package expected before this token
at Signin.<init>(Signin.java:2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at junit.framework.TestSuite.createTest(TestSuite.java:61)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:294)
at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150)
at junit.framework.TestSuite.<init>(TestSuite.java:129)
at org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:71)
at org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:14)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
)
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java:97)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Here’s my sample code.
com.example.test.Signin;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
public class Signin extends SeleneseTestCase {
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://vanilla.sqa.eqaldev.com/");
selenium.start();
}
@Test
public void testSignin() throws Exception {
selenium.open("/");
selenium.click("link=login");
selenium.waitForPageToLoad("30000");
selenium.type("id=loginStep1-email", "dbru...@eqal.com");
selenium.click("css=button.primary.right");
selenium.type("id=loginStep2a-password", "lloyds007");
selenium.click("//div[@id='loginStep2a']/div[2]/form/div[3]/button[2]");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
Best,
Dennis
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
junit.framework.AssertionFailedError: Exception in constructor: testSignin (java.lang.Error: Unresolved compilation problem:
Syntax error on token "com", package expected before this token
All,
Thanks for your support. Inserting the package fixed the test case. I’ve now run into another problem. I can start my test and run it; however when it opens the specific browser I get the following error.
chrome://src/content/RemoteRunner.html?sessionId=c43ba18e2762445ca60553dd479523b4&multiWindow=true&baseUrl=http%3A%2F%2Fvanilla.sqa.eqaldev.com%2F&debugMode=false&driverUrl=http://localhost:4444/selenium-server/driver/
Here’s a copy of the error logs:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\d11>cd..
C:\Users>cd..
C:\>cd selenium
C:\Selenium>java selenium-server-standalone-2.15.0.jar
Exception in thread "main" java.lang.NoClassDefFoundError: selenium-server-stand
alone-2/15/0/jar
Caused by: java.lang.ClassNotFoundException: selenium-server-standalone-2.15.0.j
ar
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)
Could not find the main class: selenium-server-standalone-2.15.0.jar. Program w
ill exit.
C:\Selenium>java -jar selenium-server-standalone-2.15.0.jar
Dec 29, 2011 12:14:48 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
12:14:49.812 INFO - Java: Sun Microsystems Inc. 20.1-b02
12:14:49.814 INFO - OS: Windows 7 6.1 amd64
12:14:49.824 INFO - v2.15.0, with Core v2.15.0. Built from revision 15105
12:14:49.932 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
12:14:49.934 INFO - Version Jetty/5.1.x
12:14:49.935 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
12:14:49.936 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:14:49.936 INFO - Started HttpContext[/,/]
12:14:49.972 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@45d64c
37
12:14:49.974 INFO - Started HttpContext[/wd,/wd]
12:14:49.979 INFO - Started SocketListener on 0.0.0.0:4444
12:14:49.981 INFO - Started org.openqa.jetty.jetty.Server@4d3f3045
12:15:11.488 INFO - Checking Resource aliases
12:15:11.503 INFO - Command request: getNewBrowserSession[*chrome, http://www.go
ogle.com/, ] on session null
12:15:11.516 INFO - creating new remote session
12:15:11.737 INFO - Allocated session 378c29e7a8ac483ca5fdbcdccfc9d771 for http:
//www.google.com/, launching...
12:15:11.840 INFO - Preparing Firefox profile...
12:15:15.713 INFO - Launching Firefox...
12:16:43.616 INFO - Command request: getNewBrowserSession[*chrome, http://vanill
a.sqa.eqaldev.com/, ] on session null
12:16:43.617 INFO - creating new remote session
12:16:43.618 INFO - Allocated session c48abe3b80704aceafbdf0c80272e331 for http:
//vanilla.sqa.eqaldev.com/, launching...
12:16:43.676 INFO - Preparing Firefox profile...
12:16:47.327 INFO - Launching Firefox...
12:24:21.308 INFO - Command request: getNewBrowserSession[*chrome, http://vanill
a.sqa.eqaldev.com/, ] on session null
12:24:21.308 INFO - creating new remote session
12:24:21.308 INFO - Allocated session 1ecb815b48d941b6a10ac5ff25795094 for http:
//vanilla.sqa.eqaldev.com/, launching...
12:24:21.357 INFO - Preparing Firefox profile...
12:24:25.108 INFO - Launching Firefox...
12:43:37.885 INFO - Command request: getNewBrowserSession[*chrome, http://vanill
a.sqa.eqaldev.com/, ] on session null
12:43:37.885 INFO - creating new remote session
12:43:37.886 INFO - Allocated session fcad2db1fcda4cf8b27706a8ed134122 for http:
//vanilla.sqa.eqaldev.com/, launching...
12:43:37.926 INFO - Preparing Firefox profile...
12:43:42.478 INFO - Launching Firefox...
12:44:42.266 INFO - Command request: getNewBrowserSession[*iexplore, http://vani
lla.sqa.eqaldev.com/, ] on session null
12:44:42.267 INFO - creating new remote session
12:44:42.282 INFO - Allocated session 17e6b13a767d4bf796cf89fcc135a526 for http:
//vanilla.sqa.eqaldev.com/, launching...
12:44:42.457 INFO - Launching Embedded Internet Explorer...
12:44:42.475 INFO - Launching Internet Explorer HTA...
12:45:17.971 ERROR - Failed to start new browser session, shutdown browser and c
lear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window
'null' to appear
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(Fram
eGroupCommandQueueSet.java:579)
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(Fram
eGroupCommandQueueSet.java:537)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSessi
on(BrowserSessionFactory.java:375)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowse
rSession(SeleniumDriverResourceHandler.java:809)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(Se
leniumDriverResourceHandler.java:435)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleComman
dRequest(SeleniumDriverResourceHandler.java:405)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(Selen
iumDriverResourceHandler.java:149)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
86)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
12:45:17.973 INFO - Killing Firefox...
12:45:18.060 INFO - Got result: Failed to start new browser session: Error while
launching browser on session null
12:46:49.505 ERROR - Failed to start new browser session, shutdown browser and c
lear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window
'null' to appear
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(Fram
eGroupCommandQueueSet.java:579)
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(Fram
eGroupCommandQueueSet.java:537)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSessi
on(BrowserSessionFactory.java:375)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowse
rSession(SeleniumDriverResourceHandler.java:809)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(Se
leniumDriverResourceHandler.java:435)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleComman
dRequest(SeleniumDriverResourceHandler.java:405)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(Selen
iumDriverResourceHandler.java:149)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
86)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
12:46:49.505 INFO - Killing Firefox...
12:46:49.574 INFO - Got result: Failed to start new browser session: Error while
launching browser on session null
12:47:50.348 INFO - Command request: getNewBrowserSession[*iexplore, http://www.
vanilla.sqa.eqaldev.com/, ] on session null
12:47:50.348 INFO - creating new remote session
12:47:50.349 INFO - Allocated session ef609e2979e14780b75af198f87a0f57 for http:
//www.vanilla.sqa.eqaldev.com/, launching...
12:47:50.427 INFO - Launching Embedded Internet Explorer...
12:47:50.427 INFO - Launching Internet Explorer HTA...
12:54:26.567 INFO - Command request: getNewBrowserSession[*chrome, http://vanill
a.sqa.eqaldev.com/, ] on session null
12:54:26.567 INFO - creating new remote session
12:54:26.568 INFO - Allocated session c43ba18e2762445ca60553dd479523b4 for http:
//vanilla.sqa.eqaldev.com/, launching...
12:54:26.608 INFO - Preparing Firefox profile...
12:54:27.228 ERROR - Failed to start new browser session, shutdown browser and c
lear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window
'null' to appear
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(Fram
eGroupCommandQueueSet.java:579)
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(Fram
eGroupCommandQueueSet.java:537)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSessi
on(BrowserSessionFactory.java:375)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowse
rSession(SeleniumDriverResourceHandler.java:809)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(Se
leniumDriverResourceHandler.java:435)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleComman
dRequest(SeleniumDriverResourceHandler.java:405)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(Selen
iumDriverResourceHandler.java:149)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
86)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
12:54:27.228 INFO - Killing Firefox...
12:54:27.229 WARN - Firefox seems to have ended on its own (did we kill the real
browser???)
12:54:27.361 INFO - Got result: Failed to start new browser session: Error while
launching browser on session null
12:54:30.867 INFO - Launching Firefox...