黄瓜和图像

发布于 2024-09-17 12:33:03 字数 134 浏览 2 评论 0原文

我遇到了黄瓜问题。

我不知道该对 Cucumber 说“他”必须点击图片然后看到一些文本……就像我对按钮或链接所做的那样。

当我单击图片时,我必须在屏幕上看到文本“USER OK”。

我怎样才能做到这一点?

I got a problem with Cucumber.

I don't know kow to say to Cucumber that "he" has to click on a picture and then see some text...like I do with buttons or links.

When I click on a picture, I have to see the text "USER OK" in the screen.

How can I do that?

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

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

发布评论

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

评论(2

我早已燃尽 2024-09-24 12:33:03

听起来您知道如何单击链接和按钮,但不知道如何单击图像。这可能与 Cucumber 关系不大,而与您用来控制浏览器的库(例如 watir-webdriver 或 selenium-webdriver)关系更大。如果您让我们知道您正在使用哪一种,我们可能会提供更多帮助。如果您不知道,只需粘贴适用于链接或按钮的代码示例。

根据您到目前为止提供的信息,我猜您需要执行类似 browser.image().click 的操作

It sounds like you know how to click on links and buttons but not images. That probably has less to do with cucumber and more to do with the library you are using to control the browser (e.g. watir-webdriver or selenium-webdriver). If you let us know which one you are using we might be able to help more. If you don't know then just paste an example of your code that works for a link or button.

Based on the info you've provided so far I'm guessing you need to do something like browser.image(<some selector here>).click

七色彩虹 2024-09-24 12:33:03

Cucumber 并不关心它是如何完成的。

When I check the status
Then it says the user is OK

隐藏步骤定义中的方法。将用户任务放在步骤描述中当我检查状态时,因此如果接下来检查状态的方式从单击图像更改为双击 rt-click &转动鼠标滚轮,不会影响测试。您只需重写步骤定义内部即可。验证步骤也是如此。如果文本从“USER OK”变为黄色笑脸,您仍然可以保留该步骤然后它表示用户没问题,只需更改步骤定义的内部结构即可。

现在,您对如何编写步骤定义有疑问吗?在这种情况下,您应该提供一些有关正在运行浏览器的库的信息以及一些 html 供我们查看。

Cucumber doesn't care about how it's done.

When I check the status
Then it says the user is OK

Hide the how in the step definition. Put the user task in the step description When I check the status, so if the way to check the status changes next from from clicking an image to double rt-click & spin the mouse wheel, it won't affect the tests. You just re-write the step definition innards. Same goes for the verification step. If the text changes from "USER OK" to a yellow happy face, you can still keep the step Then it says the user is OK and just change the innards of the step definition.

Now, do you have a question on how to write the step definition? In that case, you ought to provide a little info about library that is running your browser and some html for us to look at.

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