title: How can I run Selenium Webdiver test cases(Maven Project) in virtual server space through Jenkins with Headless browser?
body: <p>I have one project which is based on maven.It is run correctly in local machine with <code>mvn clean install exec:java</code> command.</p>
  
  <p>This is my <code>Pom.xml</code> to run maven project.</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;AutomationMaven&lt;/groupId&gt;
      &lt;artifactId&gt;AutomationMaven&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;AutomationMaven&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.10&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
              &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
              &lt;version&gt;2.43.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;6.8.8&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.6&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.mail&lt;/groupId&gt;
              &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;version&gt;1.4.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
              &lt;artifactId&gt;selenium-server&lt;/artifactId&gt;
              &lt;version&gt;2.43.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
      &lt;pluginManagement&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.2&lt;/version&gt;
                       &lt;configuration&gt;
                               &lt;source&gt;1.7&lt;/source&gt;
                               &lt;target&gt;1.7&lt;/target&gt;
                               &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
                               &lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
                               &lt;showWarnings&gt;true&lt;/showWarnings&gt;
                               &lt;executable&gt;${env.JAVA_HOME}/bin/javac&lt;/executable&gt;
                               &lt;fork&gt;true&lt;/fork&gt;
                       &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;  
                         &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;  
                         &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;  
                         &lt;version&gt;1.2.1&lt;/version&gt;  
                         &lt;configuration&gt;  
                            &lt;mainClass&gt;com.mainClass&lt;/mainClass&gt;  
                         &lt;/configuration&gt;  
                   &lt;/plugin&gt;  
           &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I have already set up "GIT repository" for it which is align with "Jenkins Job".</p>
  
  <p>I have made on job in "Jenkins" with this parameter
  - JDK 7
  - Xvfb setup(Need More Info about configuration)
  - maven command = mvn clean install exec:java</p>
  
  <p>I have different server for Run Maven Project (Selenium Test).</p>
  
  <p>I have getting following Track trace (Error) while run project on Server :</p>
  
  <pre><code>org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"mcHeaderLink"}
  Command duration or timeout: 30.03 seconds
  For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
  Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
  System info: host: 'ip-10-120-0-202', ip: '10.120.0.202', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-58-virtual', java.version: '1.7.0_72'
  Session ID: 6c37455f-1dbe-4a8f-acd4-a2b21ae6ec00
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=26.0}]
      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.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:393)
      at org.openqa.selenium.By$ById.findElement(By.java:214)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
      at org.openqa.selenium.support.pagefactory.DefaultElementLocator.findElement(DefaultElementLocator.java:59)
      at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:37)
      at com.sun.proxy.$Proxy22.click(Unknown Source) 
  </code></pre>