有没有办法在错误时冻结 Selenium-RC 执行?

发布于 2024-09-08 02:32:58 字数 283 浏览 2 评论 0原文

我的 Google-fu 很弱,所以我转向蜂巢思维...

我有一个最初在 IDE 中开发的 Selenium 脚本,现在我正在尝试通过 Selenium-RC 使其适应在 IE8 上运行。我正在尝试调试未找到元素的错误。

问题是,一旦发生错误,脚本就会退出,并且 RC 会关闭浏览器。这使得使用 Firebug 等工具来查看幕后发生的事情变得有点困难。

在 IDE 中,我可以简单地设置一个断点。有没有办法在发生错误时冻结 RC 和浏览器的状态?

还有其他想法吗?

谢谢!

My Google-fu is weak and so I turn to the hive mind...

I have a Selenium script I originally developed in the IDE, which I am now trying to adapt to run on IE8 via Selenium-RC. I'm trying to debug an error where an element is not being found.

The problem is that as soon as the error occurs, the script exits and RC closes the browser. This makes it a bit hard to poke around with Firebug, etc, to see what is going on under the covers.

In the IDE, I could simply set a breakpoint. Is there a way to freeze the state of RC and the browser when an error occurs?

Any other ideas?

Thanks!

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

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

发布评论

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

评论(4

一抹苦笑 2024-09-15 02:32:58

根据您运行 RC 测试的方式,您可以在 IDE 中设置断点并在调试模式下运行测试。例如,我使用 Eclipse 来使用 Java 运行测试。另一种选择是在测试中长时间暂停,只需确保之后再次将其删除..!

Depending on how you're running your RC tests, you could set a breakpoint in your IDE and run the test in debug mode. For example I use Eclipse to run tests using Java. Another option is to put a long pause in your test, just make sure you remove it again afterwards..!

甚是思念 2024-09-15 02:32:58

我正在运行 selenium rc 测试作为我的测试套件的一部分,所以我只是启动 --pdb (在 python 中),并且当发生异常时脚本暂停 - 在调用关闭浏览器的tearDown之前。

我还有一个插件,当出现问题时我可以截图。

I am running selenium rc tests as part of my test suite, so I just fire up --pdb (in python) and script pauses when exception occurs - before tearDown that closes the browser is invoked.

I have also had a plugin where I took a screenshot when something went wrong.

各自安好 2024-09-15 02:32:58

如果您使用 JUnit 和 SeleniumTestCase,则可以向测试代码添加一个空的拆卸方法,该方法应通过覆盖基本 SeleniumTestCase 拆卸方法来防止浏览器关闭。我在失败的测试中使用它,我需要在失败后检查结果浏览器状态。

If you are using JUnit and SeleniumTestCase, you can add an empty tear down method to your test code which should prevent the browser from shutting down by overriding the base SeleniumTestCase tear down method. I use this on failing tests which I need to examine the resulting browser state after a failure.

无可置疑 2024-09-15 02:32:58

在这些情况下,我在代码中注释掉 selenium.close() 和 selenium.stop() 命令,以阻止浏览器关闭。
IIRC 屏幕截图仅支持 Firefox,因此这对您的情况没有帮助。

In these situations I comment out the selenium.close() and selenium.stop() commands in my code which stops the browser from closing.
IIRC screenshot is only supported for firefox, so that won't help in your case.

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