Selenium RC:未单击按钮但测试通过

发布于 2024-09-11 17:21:15 字数 213 浏览 3 评论 0原文

我有一个脚本,它在页面中输入一些数据并单击“保存”按钮。

这里我使用 HTML 组件 id 来保存按钮。

selenium.click("StudentID:saveData");

我什至提供了适当的等待条件,并尝试使用 X 路径定位器。

测试通过。它不会抛出任何错误消息,但未单击按钮并且数据未更新。

请让我知道可能是什么问题。

I have a script which enters some data in the page and click save button.

Here I used HTML component id for save button.

selenium.click("StudentID:saveData");

I even provided proper wait condition and also tried with X path locator.

The test passes. It doesn't throw any error message but the button is not clicked and the data is not getting updated.

Please let me know what might be the issue .

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

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

发布评论

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

评论(1

黑凤梨 2024-09-18 17:21:15

我遇到了类似的问题,并使用了 CSS 选择器。 CSS 选择器比 Xpath 快得多(根据我的经验,一般情况下工作得更好,尽管 Xpath 对于某些事情是必要的)。

如果您使用的是 Firefox,请安装 Firebug 插件;右键单击页面上的元素将为您提供复制 CSS 路径的选项。我发现我经常需要对其进行一些更改才能使其正常工作,但它允许您快速访问非常深的嵌套元素。

W3C 在这里有一个关于 CSS 选择器的很好的页面。

I had a similar problem and used a CSS selector instead. CSS selectors are much faster than Xpath (and in my experience work better in general, though Xpath is necessary for certain things).

If you are using Firefox, install the Firebug add-on; right-clicking on an element on the page will give you the option to copy CSS path. I've found that I often have to make some changes to it to get it working properly but it allows you to get to very deeply nested elements quickly.

The W3C has a good page on CSS selectors here.

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