如何从命令提示符关闭 selenium hub/grid
我启动 Selenium hub,从端口 4444 上的命令提示符启动 Selenium Grid。 现在我从其他命令提示符启动 Selenium RC。
它向我显示错误消息“Selenium 已在端口 4444 上运行。或者其他一些服务正在...”
现在我无法启动 Selenium RC。请帮助我如何从命令提示符关闭/shutdown hub。
I start Selenium hub to start Selenium Grid from command prompt on port 4444.
Now I start Selenium RC from other command prompt.
It shows me error message that "Selenium is already running on port 4444. Or some other service is..."
Now I am not able to start Selenium RC. Please help me how to close /shutdown hub from command prompt.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
是关闭打开的 selenium 会话的命令。如果使用批处理文件打开会话,请删除“@pause”命令(如果使用)。当我们尝试在测试用例执行期间或之间停止和启动服务器时,这非常有用。
或者
“Ctrl + C”是最好的选择。
http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
is the command to close the opened selenium session. If the session is opened using batch file please remove the '@pause' command if its is used. This is useful when we are trying to stop and start the server during or in between test case execution.
Or
"Ctrl + C" is the best option.
从 Selenium 3.0 开始,不再支持 URL 命令 shutdownSeleniumServer。
此 github 问题表明管理生命周期的 servlet 仍然可用,但可以通过不同的 URL:
http://{hubhost}:{hubport}/lifecycle-manager/LifecycleServlet?action=shutdown
如果服务器作为节点运行,则必须在运行时启用 servlet:
< code>java -jar selenium-server-standalone-3.0.0.jar -role node -servlet org.openqa.grid.web.servlet.LifecycleServlet
节点的关闭 URL 为:
http: //{nodehost}:{nodeport}/extra/LifecycleServlet?action=shutdown
The URL command shutDownSeleniumServer is no longer supported as of Selenium 3.0.
This github issue suggests that the servlet that manages the lifecycle is still available, but accessible through a different URL:
http://{hubhost}:{hubport}/lifecycle-manager/LifecycleServlet?action=shutdown
If the server is running as a node, the servlet has to be enabled at runtime:
java -jar selenium-server-standalone-3.0.0.jar -role node -servlet org.openqa.grid.web.servlet.LifecycleServlet
And the shutdown URL for a node is:
http://{nodehost}:{nodeport}/extra/LifecycleServlet?action=shutdown
以下是关闭它的方法
http://host-server:port/selenium-server/driver /?cmd=shutDownSeleniumServer
Here is how you can shut it down
http://host-server:port/selenium-server/driver/?cmd=shutDownSeleniumServer
您只需点击此链接 http://localhost:4444/lifecycle-manager?action=shutdown
You only need to hit this link http://localhost:4444/lifecycle-manager?action=shutdown
我正在尝试这个
我们还可以使用网络浏览器来停止服务器。
您可以尝试以下 URL 来关闭服务器。
http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
I am trying this
we can also use our web browser to stop the server.
you can try following URL to shut down the server.
http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
您需要向 Selenium Hub 注册您的 RC。每个 RC 需要在不同的端口上注册(我认为)。您可以使用 ant 在特定端口上启动 RC
ant -Dport=5556 launch-remote-control
我发现运行 Grid 附带的演示非常有用:
http://selenium-grid.seleniumhq.org/run_the_demo.html
hth
You'll need to register your RC's with the Selenium Hub. Each RC needs to register on a different port (I think). You can use ant to boot the RC on a specific port
ant -Dport=5556 launch-remote-control
I found running the demos that come with Grid really helpful:
http://selenium-grid.seleniumhq.org/run_the_demo.html
hth
什么是更安全的解决方案?
或者
我正在为无头硒制作一个 init.d 脚本,这是重要的一步。
what is safer solution?
or
i am making a init.d script for headless selenium and this is important step.
最简单的方法是通过浏览器(例如 http://localhost:4444/selenium- server/driver/?cmd=shutDown),但如果您需要命令行访问,您也可以使用curl 调用该url。
It's easiest to do from a browser (e.g. http://localhost:4444/selenium-server/driver/?cmd=shutDown), but you can also call that url with curl if you need command line access.
您可以在命令窗口(集线器或RC正在运行)中按“ctrl”+“C”并停止执行批处理文件
You can to press "ctrl"+"C" in command window, (where hub or RC is running) and to stop execution of batch file
要回答如何从命令提示符关闭 selenium hub 的原始问题,您可以从 selenium-grid 文件夹中尝试此操作:
(来自文档)
全部抓取:重新启动
rake all:stop
或者对于特定端口:
全部抓取:重新启动 PORTS=5000-5010
全部抓取:停止 PORTS=5000-5010
To answer your original question of how do you close selenium hub from the command prompt, you can try this from the selenium-grid folder:
(from documentation)
rake all:restart
rake all:stop
Or for specific ports:
rake all:restart PORTS=5000-5010
rake all:stop PORTS=5000-5010
这个(http://localhost:4444/lifecycle-manager?action=shutdown) 3.0 版本中删除了链接。
在 Windows 中,您必须停止 Java 服务。
This (http://localhost:4444/lifecycle-manager?action=shutdown) link is removed under version 3.0.
In windows, you must stop Java service.
如果它在命令提示符下运行,您可以使用“taskkill”来停止所有 cmd.exe 实例。
我对 selenium grid 4 所做的就是通过批处理脚本启动具有特定名称的集线器和节点。然后为了阻止它们,我使用 taskkill 来终止具有指定名称的 cmd.exe 进程。我知道这不是有记录的方法,但它确实有效。
示例:
这将启动一个标题为 SeleniumHub 的 cmd.exe 进程,我们稍后可以引用该进程。
停止集线器:
其中 /f 是力。 /fi 是基于等于 Seleniumhub 的窗口标题的过滤器,/t 是杀死所有子进程
希望这对某人有帮助。
If it is running in a command prompt you can use "taskkill" to stop all cmd.exe instances.
What I do for selenium grid 4 is start the hub and nodes with specific names via a batch script. And then to stop them I use taskkill to kill the cmd.exe processes with the specified names. I know this isn't the documented way of doing it but it works.
Example:
This starts a cmd.exe process with a title of SeleniumHub that we can later reference.
To stop the hub:
where /f is force. /fi is filter based on the window title that equals Seleniumhub and /t is to kill all child processes
hope this helps someone.