Selenium Grid Demo Failing - selenium-grid

I am having problems getting the Selenium Grid demos to work. I try to run the tests in sequence, and although they run they all fail, without any browser being started. I have tried to run the tests with Firefox and Chrome and got the same result both times.
I followed all the instructions on this page (getting started) and installed Java jdk1.7.0_15, apache-ant-1.8.4 and selenium-grid-1.0.8 (which is apparently the current release, although I have seen Grid2 mentioned?).
I am able to successfully run the command
ant sanity-check
and have the grid compile. And then I move onto the demo page:
ant launch-hub
and I am able to view the hub at localhost:4444/console
ant launch-remote-control
and I see the available browser appear on my hub.
When I run
ant run-demo-in-sequence
The available remote control now appears as an active control in the hub and the tests run but all 4 fail. Firefox does not open and I don't see any new browsers open.
When I navigate to the target/reports/index.html page (located in the grid directory) I am able to find the following error, which is the same for each of the failed tests:
java.lang.RuntimeException: Could not start Selenium session: ERROR:
Could not retrieve a new session at
com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
at
com.thoughtworks.selenium.grid.tools.ThreadSafeSeleniumSessionStorage.startSeleniumSession(ThreadSafeSeleniumSessionStorage.java:26)
at
com.thoughtworks.selenium.grid.demo.WebTestForASingleBrowser.domme(WebTestForASingleBrowser.java:51)
at
org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:771) at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221) at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135) at
org.apache.tools.ant.taskdefs.Java.execute(Java.java:108) at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:392) at
org.apache.tools.ant.Target.performTasks(Target.java:413) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at
org.apache.tools.ant.Main.runBuild(Main.java:811) at
org.apache.tools.ant.Main.startAnt(Main.java:217) at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused
by: com.thoughtworks.selenium.SeleniumException: ERROR: Could not
retrieve a new session at
com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at
com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at
com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at
com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:223)
at
com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)
... 50 more ... Removed 29 stack frames
whilst the output in the CMD window where I launched the test reads as:
run-demo-in-sequence:
[java] [Parser] Running:
[java] Selenium Grid Demo In Sequence
[java]
[java]
[java] ===============================================
[java] Selenium Grid Demo In Sequence
[java] Total tests run: 4, Failures: 4, Skips: 0
[java] ===============================================
[java]
BUILD FAILED
C:\Program Files\selenium-grid-1.0.8-bin\selenium-grid-1.0.8\build.xml:116: Java
returned: 1
Total time: 1 minute 33 seconds
My Firefox version is 18.0.2. Also, I have seen Selenium-standalone.. mentioned in other similar questions but that is not mentioned anywhere in the tutorial I am following, do I need that?
Can anyone help get the demo working and explain where I am going wrong?

Selenium Grid 1.x is no longer in development. You should use Grid 2.0 which is mentioned here - https://code.google.com/p/selenium/wiki/Grid2
You are getting this error because, the 1.08 jar doesnt support latest versions of firefox.

Related

Selenium Video Node api

I am using selenium video node api for recording remote machine screen but when I run server or hub it run perfectly but it give error when I start node or client.
Hub Run
java -cp selenium-video-node-1.4.jar;selenium-server-standalone-2.44.0.jar org.openqa.grid.selenium.GridLauncher -servlets com.aimmac23.hub.servlet.HubVideoDownloadServlet -role hub
Node Run
java -cp selenium-video-node-1.4.jar;selenium-server-standalone-2.44.0.jar org.openqa.grid.selenium.GridLauncher -servlets com.aimmac23.node.servlet.VideoRecordingControlServlet -proxy com.aimmac23.hub.proxy.VideoProxy -role webdriver -hub http://192.168.2.245:4444/grid/register -port 6666
It give error like
11:51:30.817 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:6666/wd/hub
11:51:31.254 INFO - Could not load 64 bit native libraries - attempting 32 bit i
nstead Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'vpx': The specified module could not be found.
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:169)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:242)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:368)
at com.sun.jna.Native.loadLibrary(Native.java:353)
at com.aimmac23.node.jna.JnaLibraryLoader.tryLoadLibraries(JnaLibraryLoader.java:125)
at com.aimmac23.node.jna.JnaLibraryLoader.tryBitDepth(JnaLibraryLoader.java:150)
at com.aimmac23.node.jna.JnaLibraryLoader.init(JnaLibraryLoader.java:110)
at com.aimmac23.node.RecordVideoCallable.<clinit>(RecordVideoCallable.java:26)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.aimmac23.node.servlet.VideoRecordingControlServlet.<clinit>(VideoRecordingControlServlet.java:40)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.openqa.grid.web.utils.ExtraServletUtil.createServlet(ExtraServletUtil.java:38)
at org.openqa.grid.internal.utils.SelfRegisteringRemote.startRemoteServer(SelfRegisteringRemote.java:123)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:115)
Please Help me.
Thank you in advance
Try using the latest video node which at 2015-02-06 is https://aimmac23.com/public/maven-repository/com/aimmac23/selenium-video-node/1.6/
I'm running on a 64 bit machines - it may be that if the 64 bit native libraries don't load then the 32 bit libraries are loaded and the exception you're seeing the exception from the first attempt. You can check for yourself, the code is at: https://github.com/aimmac23/selenium-video-node
-Anton

Exception by using SafariDriver

I'm trying to run selenium safari driver.
My code is: driver = new SafariDriver();
But I get the following exception:
Caused by: java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at org.openqa.selenium.safari.SafariDriverCommandExecutor.<init>(SafariDriverCommandExecutor.java:76)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:42)
at com.ca.automation.utils.WebDriverFactory.initWebDriver(WebDriverFactory.java:168)
at com.ca.automation.utils.WebDriverFactory.getWebDriver(WebDriverFactory.java:210)
at com.ca.automation.utils.BaseSelenium.<init>(BaseSelenium.java:43)
at com.ca.automation.pb.strategicPlanning.CrudDriversBTest.<init>(CrudDriversBTest.java:20)
There could be a solution: Selenium 2 WebDriver NoClassDefFoundErrorS. You just need to use the standalone version or add all the jars to the build path.

While using Play Framework v1 and IntelliJ 13 CE and running jUnit tests, I receive an UnExpectedException during startup

I have been using IntelliJ CE for the past two weeks when suddenly I ran into problems running my unit tests within IntelliJ. My team uses Play Framework v1.2.5 and if I run the project from the command line, it compiles and runs fine. If I run the tests for the project in Eclipse Kepler, they work fine. Only when I run the tests in IntelliJ, I receive this Exception during startup:
play.exceptions.UnexpectedException: While applying play.CorePlugin#5d0a70af on models.PortfolioHoldingItem$Field$8
at play.plugins.PluginCollection.enhance(PluginCollection.java:556)
at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:235)
at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:163)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:427)
at play.Play.start(Play.java:515)
at play.test.PlayJUnitRunner.<init>(PlayJUnitRunner.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
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 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
Caused by: play.exceptions.UnexpectedException: While applying class play.classloading.enhancers.PropertiesEnhancer on models.PortfolioHoldingItem$Field$8
at play.CorePlugin.enhance(CorePlugin.java:306)
at play.plugins.PluginCollection.enhance(PluginCollection.java:551)
... 18 more
Caused by: play.exceptions.UnexpectedException: Error in PropertiesEnhancer
at play.classloading.enhancers.PropertiesEnhancer$1.edit(PropertiesEnhancer.java:177)
at javassist.expr.ExprEditor.loopBody(ExprEditor.java:198)
at javassist.expr.ExprEditor.doit(ExprEditor.java:91)
at javassist.CtBehavior.instrument(CtBehavior.java:664)
at play.classloading.enhancers.PropertiesEnhancer.enhanceThisClass(PropertiesEnhancer.java:135)
at play.CorePlugin.enhance(CorePlugin.java:301)
... 19 more
Caused by: javassist.NotFoundException: field: $assertionsDisabled in models.PortfolioHoldingItem$Field
at javassist.CtClassType.checkGetField(CtClassType.java:907)
at javassist.CtClassType.getField(CtClassType.java:896)
at javassist.CtClass.getField(CtClass.java:699)
at javassist.expr.FieldAccess.getField(FieldAccess.java:114)
at play.classloading.enhancers.PropertiesEnhancer$1.edit(PropertiesEnhancer.java:142)
... 24 more
That class is in the project, but not being tested. I've tried to:
play clean (delete the play cache)
play idealize (regenerate the IntelliJ project, re-import)
play eclipsify (regenerate the eclipse project, then import into IntelliJ)
From within IntelliJ, File | Invalidate Caches and Restart
Upgrade my JDK from 1.7.0_45 to 1.7.0_51
Upgrade to IntelliJ CE 13.1
Clone a new copy of the repo, re-import
I am on a mac, if that makes any difference. Anyone else experience this? Any suggestions for something to try?
EDIT: Same problem on my Linux dev machine.
I believe I found the solution. PlayFramework v1 has some issues with Java 7's verifier.
Adding -XX:-UseSplitVerifier to the jUnit Run/Debug configuration solved this issue.

Geb Exception: java.lang.NoClassDefFoundError: geb/error/GebException

IDE is Configured to use:
java: 7
geb: 0.9.1
Selenium java client and web driver: 2.35
When running the simple groovy script:
import geb.Browser
def browser = new Browser()
I get the following error:
Caught: java.lang.NoClassDefFoundError: geb/error/GebException
java.lang.NoClassDefFoundError: geb/error/GebException
at dave.run(dave.groovy:12)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: geb.error.GebException
... 2 more
Everything compiles just fine and according to every document available, I should be okay.
Any ideas?
Case Closed!
According to http://mvnrepository.com/artifact/org.gebish/geb-core/0.9.1, namely the "This artifact depends on ..." section, I needed some more dependencies.

Jenkins build failed on OSX

I am trying to build my project using Jenkins to deploy the artifacts to the nexus. I have a Jenkins setup on my macOSX.
below is the error, I am getting:
Parsing POMs
[maventest] $
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
-Xmx512m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/usr/share/maven/boot/plexus-classworlds-2.4.jar
org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/maven
/Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.26.jar
/Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar
59985
<===[JENKINS REMOTING CAPACITY]===>channel started
channel stopped
ERROR: Failed to parse POMs java.io.IOException: Remote call on
Channel to Maven
[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java,
-Xmx512m, -XX:MaxPermSize=128m, -Dfile.encoding=UTF-8, -cp, /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/usr/share/maven/boot/plexus-classworlds-2.4.jar,
org.jvnet.hudson.maven3.agent.Maven3Main, /usr/share/maven,
/Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.26.jar,
/Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar,
59985] failed at hudson.remoting.Channel.call(Channel.java:727) at
hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:156) at
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:770)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1593) at
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491) at
hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:247) Caused by:
java.lang.InternalError: Can't connect to window server - not enough
permissions. at java.lang.ClassLoader$NativeLibrary.load(Native
Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724) at
java.lang.Runtime.loadLibrary0(Runtime.java:823) at
java.lang.System.loadLibrary(System.java:1045) at
sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method) at
java.awt.Toolkit.loadLibraries(Toolkit.java:1605) at
java.awt.Toolkit.(Toolkit.java:1627) at
java.awt.Color.(Color.java:263) at
hudson.util.ColorPalette.(ColorPalette.java:39) at
hudson.model.BallColor.(BallColor.java:56) at
hudson.model.Result.(Result.java:51) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:171) at
com.sun.proxy.$Proxy8.(Unknown Source) at
sun.reflect.GeneratedSerializationConstructorAccessor41.newInstance(Unknown
Source) at
java.lang.reflect.Constructor.newInstance(Constructor.java:513) at
java.io.ObjectStreamClass.newInstance(ObjectStreamClass.java:929) at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1759)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
at java.util.HashMap.readObject(HashMap.java:1030) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:979)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
at hudson.remoting.UserRequest.deserialize(UserRequest.java:182) at
hudson.remoting.UserRequest.perform(UserRequest.java:98) at
hudson.remoting.UserRequest.perform(UserRequest.java:48) at
hudson.remoting.Request$2.run(Request.java:326) at
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138) 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) Finished: FAILURE
I already tried the below solution but it didn't work:
http://jenkins-ci.361315.n4.nabble.com/JIRA-Created-HUDSON-5584-java-io-IOException-Remote-call-on-Channel-to-Maven-td1475049.html
Configurations I have:
MAVEN_OPTS:-Xmx1024m
-XX:MaxPermSize=128m
-Dfile.encoding=UTF-8
-Djava.awt.headless=true
output of ps -ef | grep java: /usr/bin/java -Djava.awt.headless=true -jar /Applications/Jenkins/jenkins.war
build command:clean deploy -DaltDeploymentRepository=central::default::http://<user>:<pwd>#<host>:<port>/nexus/content/groups/public/
The solution I used was to apply Java 7. What you want to do is add 1.7 to Jenkins. Following these steps I was able to successfully build my project:
Go to the Oracle Java page and downloaded the 1.7_51 jdk for Mac.
Opened the dmg and ran the executable.
On the Mac, this installs the JDK to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/
In Jenkins, go to 'Manage Jenkins' > 'Configure System'
Under the JDK heading, click the button that says JDK Installations
Under Name type 'JDK 1.7.0_51'
For JAVA_HOME type '/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/'
Select Save
Go to your project and select Configure
You should now have a JDK drop down near the top of the page.
Select the JDK you just configured under 'Manage Jenkins'
Run the build
After doing this, my build successfully ran without the 'Can't connect to window server - not enough permissions error.'
This line looks curious:
hudson.model.Executor.run(Executor.java:247) Caused by: java.lang.InternalError:
Can't connect to window server - not enough permissions. at java.lang.ClassLoader
$NativeLibrary.load(Native Method)
I would start with a simpler project, and then add complexity from that point, for the reason of just testing to make sure your basic assumptions are correct.
You might need to set the JVM property : -Djava.awt.headless=true . By doing that you will disable the (most likely unnecessary) gui libraries that are trying to load.