I have a Selenium
Script which as below :
package TestCase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestCase {
public static void main(String[] args)
{
System.setProperty("webdriver.firefox.marionette","/root/Desktop/Selenium/GeckoDriver/geckodriver.exe");
for(int i=0;i<5;i++)
{
WebDriver driver = new FirefoxDriver();
driver.get ("http://cl.amtrustmobilesolutions.asia/cs/login.php");
WebElement username=driver.findElement(By.name("user_name"));
username.sendKeys("username");
WebElement passsword=driver.findElement(By.name("user_password"));
passsword.sendKeys("password");
driver.findElement(By.xpath("//button[contains(@class,'buttonuser')]")).click();
}
}
}
I want to trigger this script using a JSP
page :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Enter your name</title>
</head>
<body>
<jsp:useBean id = "TestBean" class = "TestCase.TestCase" />
</body>
</html>
But it gave me an error :
Internal Server Error
The server encountered an internal error that prevented it from fulfilling this request.
java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.
How can I use JSP pages to trigger the Selenium Script?