title: Does selenium webdriver support Struts 2
body: <p>I want to use <code>Selenium WebDriver API</code> using <code>Struts2</code> Framework. So will it be supported or not.</p>
  
  <p>If not then what should I do.</p>
  
  <p>It means, suppose I have an <code>textfield</code> on my <code>jsp</code>, linked with action class and I want search on <a href="http://www.google.com" rel="nofollow">www.google.com</a> with my <code>textfield</code> value by <code>sendKeys</code> to element "q".</p>
  
  <p>What am trying to do is</p>
  
  <p>index.jsp :
      </p>
  
  <pre><code>&lt;s:form action="test"&gt;
  &lt;s:textfield name="search" label="Enter Search "&gt;&lt;/s:textfield&gt;
  &lt;/s:form&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>struts.xml:</p>
  
  <pre><code>    &lt;action name="test" class="com.actions.TestAction"&gt;
            &lt;result name="SUCCESS"&gt;/success.jsp&lt;/result&gt;
      &lt;/action&gt;
  </code></pre>
  
  <p>ActionClass : </p>
  
  <pre><code>package com.actions;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.htmlunit.HtmlUnitDriver;
  
  import com.opensymphony.xwork2.ActionSupport;
  
  public class TestAction extends ActionSupport
  {
  
      private String search;
  
      public String getSearch() {
          return search;
      }
  
      public void setSearch(String search) {
          this.search = search;
      }
  
  
      private static final long serialVersionUID = -1241657564582564726L;
  
      @Override
      public String execute() throws Exception {
  
          WebDriver driver = new HtmlUnitDriver();
  
          driver.get("http://www.google.com");
  
          WebElement element = driver.findElement(By.name("q"));
  
  
          element.sendKeys(getSearch());
  
          element.submit();
  
  
          System.out.println("Page title is: " + driver.getTitle());
  
  
          System.out.println(driver.getPageSource());        
  
          driver.quit();
          return "SUCCESS";
      }
  
  
  }
  </code></pre>
  
  <p>Error :</p>
  
  <pre><code>SEVERE: Exception starting filter struts2
  java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
      at java.lang.Class.getConstructor0(Unknown Source)
      at java.lang.Class.getConstructor(Unknown Source)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:428)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:378)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:495)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:286)
      at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
      at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
      at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
      at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
      at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
      at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:104)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
  </code></pre>
  
  <p>eagerly waiting for your replies. 
  Thank You !   </p>