[英]Getting Error while Launching Selenium Web Driver from Servlet with Tomcat Server
我已经编写了一个java代码来捕获使用selenium web驱动程序的网页截图,通常java代码运行良好,但在servlet中使用相同的代码会给我一个错误。
package CaptureImages;
public class SeleniumTest extends HttpServlet{
private static final long serialVersionUID = 1L;
public void service(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException{
WebDriver driver_rbi = new FirefoxDriver();
// WebDriver driver_rbi=new HtmlUnitDriver(); //html unit driver
driver_rbi.get("http://www.rbi.org.in/commonman/English/Scripts/BanksInIndia.aspx");
try{
//CaptureRBI.captureRBIScreens();
System.out.println("webpage launched...");
//File scrFile = ((TakesScreenshot) driver_rbi).getScreenshotAs(OutputType.FILE);
//FileUtils.copyFile(scrFile, new File("C:\\Users\\srawat2\\Desktop\\surya code\\selenium\\ScreenShots\\RBI\\RBI.png"));
System.out.println("Quiting driver...");
//driver_rbi.quit();
}
catch(Exception e){
}
// PrintWriter out = response.getWriter();
}
} 错误:java.lang.ClassNotFoundException:com.google.common.base.Function
你需要谷歌番石榴图书馆 。 事实上,在解决此问题后,您将需要大量其他库。 因此,最好在类路径中包含所有selenium库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.