Selenium IDE:我无法使用 selenium IDE 记录从 Web 应用程序的下拉列表中选择的值

发布于 2024-09-18 00:59:48 字数 280 浏览 4 评论 0原文

这就是我想要做的:

  1. 打开我的网络应用程序
  2. 转到详细信息页面以创建新实体
  3. 在创建实体时,我需要从下拉列表中选择一些值 下来并将其记录在 Selenium IDE 上
  4. 完成上述所有步骤后,它们已记录到 Selenium IDE 中
  5. 当我播放时,每当它尝试执行操作时都会抛出错误 运行脚本,其中一些 需要从下拉列表中进行选择。

已经被这个问题困扰了一段时间了。尝试使用“焦点”,但效果不佳。任何人都可以在这方面提供帮助吗?

This is what I am trying to do:

  1. Open my web application
  2. Go to the details page to create a new entity
  3. While creating entity, I need to select some values form the drop
    down and record it on Selenium IDE
  4. Did all the above steps, they were recorded into Selenium IDE
  5. When I play back, it is trowing an error whenever it is trying to
    run the script, where some
    selections from dropdown is needed.

Have been stuck with this for quite sometime now. Tried using "focus", but it did not work as well. Can anyone help in this regards?

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

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

发布评论

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

评论(3

眉目亦如画i 2024-09-25 00:59:48

获取 Firebug

检查元素以找出该 UI 元素的类 ID。

  • 命令:选择
  • 目标:类 ID
  • 值:标签=[此 ID 下拉列表中的值] 例如(标签=夏威夷,如果您正在处理一个州,并且该值是下拉列表中的值)

您获得该值的代码使用标签时状态值将如下所示。

option value="HI">夏威夷

应该可以了。

Get Firebug

Inspect the element to find out the class ID of that UI Element.

  • Command: Select
  • Target: class ID
  • Value: label=[value in drop down of this ID] For example (label=Hawaii if you're dealing with a state and that is the value in the drop down)

The code where you get that state value would look like this where you use the label.

option value="HI">Hawaii</option

That should do it.

乙白 2024-09-25 00:59:48

由于我不了解您的网络应用程序,我将提出一些建议。

记录和重播并不总是捕获它需要回复的所有项目。不幸的是,这是一个用词不当。

尝试执行 select |定位器 | itemInSelect

可能值得添加一个 waitForX,其中 X 是您正在等待的项目,在此之前调用,以防测试到达该点时未加载 select。

Since I don't know your web application I am going to make a number of suggestions.

Record and replay will not always capture all of the items that it needs to reply. This is a misnomer unfortunately.

Try doing select | locator | itemInSelect

It might be worth adding a waitForX, where X is the item you are waiting for it, call before that in case that select is not loaded when the test hits that point.

江湖正好 2024-09-25 00:59:48

我在邮政编码框中输入邮政编码,然后从出现的下拉列表中选择商店,也遇到了类似的问题。
记录的动作并不完全准确。

我最终通过使用 sendKeys (与您无关)修复它,暂停并单击(获取选择的 xpath)

I had a similar issue with post code boxes into which you enter a postcode, and then select a Store from the dropdown that appears.
The actions recorded were not completely accurate.

I ended up fixing it by using sendKeys (not relevant to you), pause and click (got the xpath of the selection)

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