错误问题:有意外的确认!

发布于 2024-08-18 14:33:04 字数 507 浏览 11 评论 0原文

我正在尝试从表中删除用户。起初,我收到超时错误,但使用了 BeatnicClick(),如下所述:

Selenium IDE click() timeout

这解决了超时错误,但我仍然收到意外的确认错误。这是部分源代码:

selenium.Click("ctl00_btnAddressBook"); selenium.WaitForPageToLoad("30000");

// selenium.BeatnicClick("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");

String 您确定要删除吗 所选项目? = selenium.GetConfirmation();

任何帮助将不胜感激。提前致谢。

I am trying to delete a user from a table. At first I was getting a timeout error but used the BeatnicClick() as described here:

Selenium IDE click() timeout

That solved the timeout error but I'm still getting the unexpected confirmation error. Here's part of the source code:

selenium.Click("ctl00_btnAddressBook");
selenium.WaitForPageToLoad("30000");

// selenium.BeatnicClick("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");

String Are you sure you want to delete
the selected item? =
selenium.GetConfirmation();

Any help would be appreciated. Thanks in advance.

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

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

发布评论

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

评论(1

紫﹏色ふ单纯 2024-08-25 14:33:04

要处理确认,您的代码应该如下所示

selenium.Click("ctl00_btnAddressBook"); 
selenium.WaitForPageToLoad("30000");
//the IDE code is to get around the IDE bug that it waits on click but it works in Se:RC
selenium.Click("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");
//handle the confirmation that appears after the click
string confirmMessage = selenium.GetConfirmation();
//Assert its the correct message
Assert.IsTrue(Regex.IsMatch(confirmMessage,"Are you sure you want to delete the selected item?"));

这应该单击删除元素,然后获取确认,如果您想要它可以断言其正确的消息

To handle the confirmation your code should look like

selenium.Click("ctl00_btnAddressBook"); 
selenium.WaitForPageToLoad("30000");
//the IDE code is to get around the IDE bug that it waits on click but it works in Se:RC
selenium.Click("ctl00_page_content_ExistingEmployees_ctl03_btnDeleteEmployee");
//handle the confirmation that appears after the click
string confirmMessage = selenium.GetConfirmation();
//Assert its the correct message
Assert.IsTrue(Regex.IsMatch(confirmMessage,"Are you sure you want to delete the selected item?"));

This should click on the delete element and then get the confirm and if you want it can assert its the correct message

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