Selenium RC - selenium-browserbot.js 错误

发布于 2024-08-24 01:02:41 字数 600 浏览 4 评论 0原文

我正在用 C# 编写一些自动化测试,当我尝试单击将提交对 Web 表单所做的更改的按钮时,会引发 JavaScript 错误。我收到的错误是:

An error has occured in the script on this page 
Line:  2004 
Char:  9 
Error:  Permission denied 
Code:  0 
URL:  file:///C:/DOCUME~1/nkinney/LOCALS~1/Temp/customProfileDir6c0c7d7226cc463fb­b1a7f6253c4df62/core/scripts/selenium-browserbot.js 

测试完成后,如果我在 selenium 运行时手动单击按钮,仍然会显示错误。

硒中选择此按钮的行是:

selenium.Click("//input[contains(@id, 'SubmitBtn')]"); 

我也尝试过提交。

应显示一个弹出窗口,要求用户确认他们想要进行更改。在显示弹出窗口之前和 Selenium“单击”按钮之后抛出此错误。

任何建议将不胜感激。

I'm writing some automated tests in C# and a JavaScript error is thrown when I try to click on a button that will submit changes made to a web form. The error I am recieving is:

An error has occured in the script on this page 
Line:  2004 
Char:  9 
Error:  Permission denied 
Code:  0 
URL:  file:///C:/DOCUME~1/nkinney/LOCALS~1/Temp/customProfileDir6c0c7d7226cc463fb­b1a7f6253c4df62/core/scripts/selenium-browserbot.js 

Once the test is finished, the error will still be displayed if I manually click on the button while selenium is running.

The line in selenium to select this button is:

selenium.Click("//input[contains(@id, 'SubmitBtn')]"); 

I've also tried submit.

A pop-up should be displayed asking the user to confirm they want to make the changes. This error is thrown before the pop-up is displayed and after Selenium 'clicks' on the button.

Any advise would be greatly appreciated.

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

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

发布评论

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

评论(2

勿忘心安 2024-08-31 01:02:41

经过进一步调查,我发现 Selenium 无法使用自定义模式对话框。也就是说,我认为我无法在当前版本中使用 Selenium 来自动化 UI 测试。感谢所有看过这篇文章的人。

After further investigation, I found that Selenium is unable to work with custom modal dialog boxes. That said, I don't think I will be able to use Selenium to automate UI testing in our current release. Thanks to anyone who looked at this post.

↙温凉少女 2024-08-31 01:02:41

来自 Selenium 常见问题解答

我无法与弹出对话框交互。我的测试停止了!

您可以,但前提是该对话框是警报或确认对话框。
其他特殊对话框无法被 JavaScript 关闭,因此
目前无法与之互动。其中包括“保存文件”,
“记住此密码”(Firefox) 和模态 (IE) 对话框。当他们
出现了,Selenium只能绝望地绞尽脑汁。

要解决此问题,您可以使用一种解决方法(如果存在);
否则,您可能必须从自动化语料库中排除该测试。
对于 Firefox 中的“保存文件”对话框,自定义模板可能是
通过 RC 运行时指定,这将始终导致文件
下载到指定位置,无需询问用户(请参阅
http://forums.openqa.org/thread.jspa?messageID=31350)。 ”记住
在您选择后,“此密码”对话框不应再次出现
记住它。目前对 IE 能做的不多
模式对话框。

您是否可以选择查看测试是否在其他浏览器(Firefox、Chrome)中运行?

这里也有一个非常相似的答案: How do I test modaldialogs with Selenium ?

From the Selenium FAQ

I can't interact with a popup dialog. My test stops in its tracks!

You can, but only if the dialog is an alert or confirmation dialog.
Other special dialogs can't be dismissed by javascript, and thus
currently cannot be interacted with. These include the "Save File",
"Remember this Password" (Firefox), and modal (IE) dialogs. When they
appear, Selenium can only wring its hands in despair.

To solve this issue, you may use a workaround (if one exists);
otherwise you may have to exclude the test from your automated corpus.
For the "Save File" dialog in Firefox, a custom template may be
specified when running via the RC that will always cause the file to
be downloaded to a specified location, without querying the user (see
http://forums.openqa.org/thread.jspa?messageID=31350). The "Remember
this Password" dialog should not appear again after you've chosen to
remember it. Currently there is not much that can be done about IE
modal dialogs.

Do you have the option of seeing if the test runs in another browser (Firefox, Chrome)?

A very similar answer is also here: How do I test modal dialogs with Selenium?

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