selenium - Selenium Testcase 播放错误

标签 selenium selenium-rc

每当我尝试在 Selenium 中播放测试用例时,我总是会遇到此错误

   [error] Permission denied for <http://www.facebook.com> to get property Location.href

最佳答案

听起来您遇到了 javascript 的同域安全策略。

参见此处:http://www.codingforums.com/showthread.php?t=117050 .

如果没有关于您的测试用例的更多信息,很难具体说明,但基本问题可能是

JavaScript has a same domain policy for security reasons. That means it can not touch other domains.

在链接资源的示例中,用户能够替换

top.document.location.href = searchLocation;

window.open(searchLocation, "_top");

解决问题。

关于selenium - Selenium Testcase 播放错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8236026/

相关文章:

internet-explorer - IE 的 Selenium 脚本

selenium - 阅读警报消息并单击“确定”

java - 使用 cssSelector 或 xPath Selenium Web 驱动程序在过滤器上应用按钮?

java - Selenium CSS 选择器语法用于检查类和文本

python - 查找页面上文本的部分内容,然后使用 Selenium 在 Python 中返回该 <div> 的完整内容

javascript - 与注入(inject) JavaScript 自动化相比,WebDriver 协议(protocol)有什么好处?

javascript - 在 selenium 中加载包含有用测试函数的外部 js 文件

java - 使用 selenium 单击 "rel"属性

python - 带有 selenium 的 Browsermob 代理生成空输出

java - 如何使用 java 单击按钮停止 selenium 服务器?