javascript - Selenium IDE 1.4.1 throwing security error when uploading a local file - Stack Overflow

with this simple configuration:<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN" &q

with this simple configuration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ".dtd">
<html xmlns="" xml:lang="en" lang="en">
<head profile="">
<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) {
  }
};

with this simple configuration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa/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) {
  }
};
Share Improve this question edited Nov 16, 2011 at 13:11 Martin Dimitrov asked Nov 16, 2011 at 9:33 Martin DimitrovMartin Dimitrov 4,9766 gold badges50 silver badges64 bronze badges 5
  • It would probably help to look up chrome://selenium-ide/content/selenium-core/scripts/atoms.js, line 8910 ;) – Wladimir Palant Commented Nov 16, 2011 at 9:37
  • @Wladimir Palant: can't determine the correct line. Line 8910 is ` a.value = d` which souldn't trigger an exception – Martin Dimitrov Commented Nov 16, 2011 at 10:00
  • Given that this is NS_ERROR_DOM_SECURITY_ERR - it might be, if a is something from a different document. It is probably best if you edit the context of this line into your question. – Wladimir Palant Commented Nov 16, 2011 at 11:35
  • This sounds like Selenium bug #2826: code.google./p/selenium/issues/detail?id=2826 – Ross Patterson Commented Nov 16, 2011 at 16:54
  • @Ross Patterson: yep! this is the same bug. thanks, can you move it to an answer so i can accept it. thanks again. – Martin Dimitrov Commented Nov 16, 2011 at 18:48
Add a ment  | 

2 Answers 2

Reset to default 4

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.

This sounds like Selenium bug #2826.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744113680a4559071.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信