黄瓜 + JavaScript 应用程序中的 Selenium

发布于 2024-07-13 02:32:21 字数 288 浏览 3 评论 0原文

我正在尝试学习如何最好地使用 Cucumber + Selenium。 在大多数情况下,它似乎非常简单,但我想获得一些有关如何测试对话框的指导。 基本上我需要实现:

assert !60.times{
   break if ("Other Income" == @selenium.get_text("//form[@id='new_account']/h3")  rescue false); sleep 1 }  

标准等待形式。 如何在 Cucumber 规范中实现此目的?

I am trying to learn how to best use Cucumber + Selenium. For the most part it seems to be very straight forward but I would like to get some guidance on how to test dialogs. Basically I need to implement:

assert !60.times{
   break if ("Other Income" == @selenium.get_text("//form[@id='new_account']/h3")  rescue false); sleep 1 }  

A standard wait for form. How do I accomplish this in a Cucumber spec?

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

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

发布评论

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

评论(3

歌入人心 2024-07-20 02:32:21

要稍微更新这个答案,我强烈建议使用 Capybara:

http://github.com/jnicklas/capybara

只需安装一个 gem 即可使用 javascript!

To update this answer a bit, I'd highly recommend using Capybara:

http://github.com/jnicklas/capybara

Being able to use javascript is just a gem install away!

归途 2024-07-20 02:32:21

看看 https://github.com/cucumber/cucumber/wiki/setting- up-selenium 进行了相当彻底的演练,以及 Cucumber 附带的示例(原生示例通过 webrat 使用 selenium) 。

Look at https://github.com/cucumber/cucumber/wiki/setting-up-selenium for a pretty thorough walkthrough, plus the examples which come with Cucumber (native examples and selenium through webrat).

末が日狂欢 2024-07-20 02:32:21

本指南已过时,即将进行修复,但与此同时您不需要 Selenium gem。 另外,您必须使用 selenium-client -v=1.2.14。 您不需要覆盖任何罐子。 确保所有 selenium 进程都已停止并安装了正确的版本并且它应该运行。 有关硒/非硒测试的多个环境的信息仍然有效且有用。

This guide is out of date, a fix is upcoming but in the meantime you do not need the Selenium gem. Also, you must use selenium-client -v=1.2.14. You do not need to overwrite any jars. Make sure all selenium processes are stopped and the correct versions are installed and it should run. The information about multiple environments for selenium/non-selenium tests is still valid and useful.

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