我如何以编程方式控制 Selenium RC 的启动和停止

发布于 2024-09-07 02:40:36 字数 889 浏览 4 评论 0原文

目前我使用 HTMLSuite 使用 selenium。我用来启动服务器并运行测试套件的命令如下所示

java -jar selenium-server.jar -htmlsuite "*iexplore" "http://localhost:8080" "C:\test\testsuite" "C:\test\result_%Yr%%Mth%%Day%.html"

我有一些测试套件,其中有一些需要首先运行的sql脚本。我想要运行它们的方式顺序如下所示

run sql script 1
run testsuite 1
run sql script2
run testsuite 2
run sql script 3
run testsuite 3

sql 脚本不能同时运行,所以我必须运行一个脚本,运行 selenium 测试并继续下一个脚本。

我计划将这些命令放入 Windows 批处理文件中,但我不确定如何停止 selenium 服务器。批处理作业中的事件顺序如下

run sql script1
start selenium server
run testsuite 1
stop selenium server
run sql script 2
start selenium server
run testsuite 2
stop selenium server
run sql script 3
start selenium server
run testsuite 3

我的问题实际上是:-

  • 如何从 Windows 批处理作业中停止 selenium 服务器。
  • 我认为最好只启动一次服务器。这将需要能够控制和访问当前窗口。是否可以指定正在运行硒测试的当前活动窗口?

At the moment i use selenium using HTMLSuite. The command i use to start the server and run the a testsuite is shown below

java -jar selenium-server.jar -htmlsuite "*iexplore" "http://localhost:8080" "C:\test\testsuite" "C:\test\result_%Yr%%Mth%%Day%.html"

I have some testsuites which have some sql scripts which need to be run first. The sequence of the way i want to run them is shown below

run sql script 1
run testsuite 1
run sql script2
run testsuite 2
run sql script 3
run testsuite 3

The sql script cant all be run at the same time so i have to run one script, run the selenium tests and continue with the next one.

I plan to put these commands in a Windows batch file but i am not sure how to stop the selenium server. The sequence of events in the batch job is like this

run sql script1
start selenium server
run testsuite 1
stop selenium server
run sql script 2
start selenium server
run testsuite 2
stop selenium server
run sql script 3
start selenium server
run testsuite 3

My questions really are:-

  • How do i stop selenium server from a windows batch job.
  • I think it is better to just start the server once. This will require the ability to control and access the current window. Is it possible to specify the current active window that is running the selenium tests?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猥︴琐丶欲为 2024-09-14 02:40:36

这是一个有用的帖子,应该可以帮助您完成您需要的操作。

Here's a useful post that should help you do what you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文