【发布时间】:2013-01-14 08:08:02
【问题描述】:
我无法通过测试,因为 canoo 不支持外部 js 文件中的全局变量。
index.html:
<html>
<head>
<script src="index.js"></script>
</head>
<body>
<button onclick="alert(a+1);">asldkf</button>
</body>
</html>
index.js
var a=1;
CanooWebtest 抛出:
JavaScript error loading page
http://localhost:8080/index.html:
ReferenceError: "a" is not defined. (JavaScriptStringJob#1)
有什么建议吗?
【问题讨论】:
-
在文档加载并准备好之前,我不会尝试执行该脚本。
-
自not all browsers handle it properly以来,您不应在脚本元素中使用空标记表示法。
-
@jbabey,好的,我编辑了我的问题,还是出现了错误。
-
@epascarello,好的,我编辑了我的问题,错误还是出现了。
标签: javascript web-testing canoo