Selenium IDE 1.4.1 上传本地文件时抛出安全错误

发布于 2024-12-16 15:59:49 字数 3005 浏览 3 评论 0原文

通过这个简单的配置:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://localhost:8080/" />
<title>basic</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<tr>
    <td>open</td>
    <td>/upload.html</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>foo</td>
    <td>C:\Temp\harmony\tests\02.basic\config.xml</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>//input[@value='Upload']</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=go to home</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=New order</td>
    <td></td>
</tr>
</table>
</body>
</html>

我收到以下错误:

[error] Unexpected Exception: code -> 1000, INDEX_SIZE_ERR -> 1, DOMSTRING_SIZE_ERR -> 2, HIERARCHY_REQUEST_ERR -> 3, WRONG_DOCUMENT_ERR -> 4, INVALID_CHARACTER_ERR -> 5, NO_DATA_ALLOWED_ERR -> 6, NO_MODIFICATION_ALLOWED_ERR -> 7, NOT_FOUND_ERR -> 8, NOT_SUPPORTED_ERR -> 9, INUSE_ATTRIBUTE_ERR -> 10, INVALID_STATE_ERR -> 11, SYNTAX_ERR -> 12, INVALID_MODIFICATION_ERR -> 13, NAMESPACE_ERR -> 14, INVALID_ACCESS_ERR -> 15, VALIDATION_ERR -> 16, TYPE_MISMATCH_ERR -> 17, DATA_CLONE_ERR -> 25, message -> Security error, result -> 2152924136, name -> NS_ERROR_DOM_SECURITY_ERR, filename -> chrome://selenium-ide/content/selenium-core/scripts/atoms.js, lineNumber -> 8910, columnNumber -> 0, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/atoms.js :: <TOP_LEVEL> :: line 8910, inner -> null, data -> null

升级到 Firefox 8 后会发生这种情况。在此之前测试工作得很好。 Selenium IDE 版本是 1.4.1,这似乎是最后一个。

请帮忙。

谢谢。

马丁

编辑:错误行是:a.value = d。这是整个函数:

core.events.replaceText_ = function(a, b) {
  bot.events.fire(a, "focus", {bubble:!1});
  bot.events.fire(a, "select");
  var c = bot.dom.getAttribute(a, "maxlength"), d = b;
  c != null && (c = parseInt(c), b.length > c && (d = b.substr(0, c)));
  if(bot.dom.isElement(a, goog.dom.TagName.BODY)) {
    if(a.ownerDocument && a.ownerDocument.designMode && (new String(a.ownerDocument.designMode)).toLowerCase() == "on") {
      a.innerHTML = d
    }
  }else {
    a.value = d
  }
  try {
    bot.events.fire(a, "change")
  }catch(e) {
  }
};

with this simple configuration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://localhost:8080/" />
<title>basic</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<tr>
    <td>open</td>
    <td>/upload.html</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>foo</td>
    <td>C:\Temp\harmony\tests\02.basic\config.xml</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>//input[@value='Upload']</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=go to home</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=New order</td>
    <td></td>
</tr>
</table>
</body>
</html>

I get the following error:

[error] Unexpected Exception: code -> 1000, INDEX_SIZE_ERR -> 1, DOMSTRING_SIZE_ERR -> 2, HIERARCHY_REQUEST_ERR -> 3, WRONG_DOCUMENT_ERR -> 4, INVALID_CHARACTER_ERR -> 5, NO_DATA_ALLOWED_ERR -> 6, NO_MODIFICATION_ALLOWED_ERR -> 7, NOT_FOUND_ERR -> 8, NOT_SUPPORTED_ERR -> 9, INUSE_ATTRIBUTE_ERR -> 10, INVALID_STATE_ERR -> 11, SYNTAX_ERR -> 12, INVALID_MODIFICATION_ERR -> 13, NAMESPACE_ERR -> 14, INVALID_ACCESS_ERR -> 15, VALIDATION_ERR -> 16, TYPE_MISMATCH_ERR -> 17, DATA_CLONE_ERR -> 25, message -> Security error, result -> 2152924136, name -> NS_ERROR_DOM_SECURITY_ERR, filename -> chrome://selenium-ide/content/selenium-core/scripts/atoms.js, lineNumber -> 8910, columnNumber -> 0, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/atoms.js :: <TOP_LEVEL> :: line 8910, inner -> null, data -> null

This happens after upgrating to Firefox 8. Before that the test worked just fine. The Selenium IDE version is 1.4.1 and this seems to be the last one.

Please, help.

Thank you.

Martin

EDIT: The line from the error is: a.value = d. Here is the whole function:

core.events.replaceText_ = function(a, b) {
  bot.events.fire(a, "focus", {bubble:!1});
  bot.events.fire(a, "select");
  var c = bot.dom.getAttribute(a, "maxlength"), d = b;
  c != null && (c = parseInt(c), b.length > c && (d = b.substr(0, c)));
  if(bot.dom.isElement(a, goog.dom.TagName.BODY)) {
    if(a.ownerDocument && a.ownerDocument.designMode && (new String(a.ownerDocument.designMode)).toLowerCase() == "on") {
      a.innerHTML = d
    }
  }else {
    a.value = d
  }
  try {
    bot.events.fire(a, "change")
  }catch(e) {
  }
};

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

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

发布评论

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

评论(2

森末i 2024-12-23 15:59:49

在firefox扩展目录中找到atom.js文件并按函数体搜索:

core.events.replaceText

因此,查找带有:的行

a.value = d

并将其更改为:

XPCNativeWrapper(a).value = d;

它将修复该错误。

Find the file atom.js at firefox extensions directory and search by the function body:

core.events.replaceText

So, look for the line with:

a.value = d

and change it to:

XPCNativeWrapper(a).value = d;

It will fix the bug.

墨离汐 2024-12-23 15:59:49

这听起来像是 Selenium bug #2826

This sounds like Selenium bug #2826.

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