我想通过启动selenium-server-standalone-2.19.0.jar -servlets来添加自己的servlet,但是无法弄清楚如何去做。
是否可以找到关于selenium2 servlets的开发人员指南?
一个例子也很不错。
tnx很多!我的工作解决方案:
1)结帐http://selenium.googlecode.com/svn/tags/selenium-2.19.0
2)创建了从RegistryBasedServlet扩展的HubServlet
package org.openqa.grid.web.servlet.alpha; ... 公共类HubServlet扩展了RegistryBasedServlet { ... }
3)建设
./ go clean release(仅一次)
./ go // java / server / src / org / openqa / grid / selenium:selenium:uber(每次我在org.openqa.grid.web.servlet.alpha.HubServlet上更改内容)
答案 0 :(得分:4)
对我有用的解决方案:
从googlecode中查看selenium2来源
$ svn co http://selenium.googlecode.com/svn/tags/selenium-2.19.0 selenium
更改为selenium目录
$ cd selenium
添加servlet文件夹“alpha”
$ mkdir -p java/server/src/org/openqa/grid/web/servlet/alpha
添加servlet classe(s)
package org.openqa.grid.web.servlet.alpha;
public class HubServlet extends RegistryBasedServlet {
...
}
制作HubServlet.jar
$ ./go clean //java/server/src/org/openqa/grid/web/servlet/alpha:HubServlet
从googlecode selenium-server-standalone-2.19.0.jar获取
$ wget http://selenium.googlecode.com/files/selenium-server-standalone-2.19.0.jar -O selenium-server-standalone-2.19.0.jar
合并jar(s)
$ mkdir tmp
$ (cd tmp; jar -xf "build/java/server/src/org/openqa/grid/web/servlet/alpha/HubServlet.jar")
$ (cd tmp; jar -xf selenium-server-standalone-2.19.0.jar)
$ jar -cfM selenium-server-standalone.jar -C $dir_sel_build/tmp .
使用“-servlets”参数启动selenium-server-standalone.jar
$ java -jar selenium-server-standalone.jar -role hub -servlets org.openqa.grid.web.servlet.alpha.HubServlet
15.03.2012 16:25:07 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
15.03.2012 16:25:08 org.openqa.grid.web.Hub <init>
INFO: binding org.openqa.grid.web.servlet.alpha.HubServlet to /grid/admin/HubServlet/*
361 [main] INFO org.seleniumhq.jetty7.server.Server - jetty-7.x.y-SNAPSHOT
392 [main] INFO org.seleniumhq.jetty7.server.handler.ContextHandler - started
o.s.j.s.ServletContextHandler{/,null}
400 [main] INFO org.seleniumhq.jetty7.server.AbstractConnector - Started
SocketConnector@0.0.0.0:4444