【问题标题】:Error in running Selenium Test case through command line通过命令行运行 Selenium 测试用例时出错
【发布时间】:2025-11-27 02:00:01
【问题描述】:

我尝试使用以下命令运行 selenium 测试。

java -jar selenium-server-standalone-2.53.0.jar -htmlSuite "*firefox" "http://google.com" "/Users/abhee/Downloads/TestGoogle.html" "/Users/abhee/Downloads/results.html"

它会打开 Firefox 并显示以下窗口。当我单击窗口中的任何按钮时,什么都没有发生。有什么问题? ,我在控制台中看到以下消息:

The Components object is deprecated. It will soon be removed. atoms.js:5462:6
unreachable code after return statement htmlutils.js:6182:0
The character encoding declaration of the HTML document was not found when prescanning the first 1024 bytes of the file. When viewed in a differently-configured browser, this page will reload automatically. The encoding declaration needs to be moved to be within the first 1024 bytes of the file. Blank.html:100:0
Error: Permission denied to access property "frames"
 selenium-remoterunner.js:538:21
Error: Permission denied to access property "frames"
 selenium-remoterunner.js:538:21
The Components object is deprecated. It will soon be removed. atoms.js:5462:6
unreachable code after return statement htmlutils.js:6182:0
Error: Permission denied to access property "frames"

编辑:

代码中没有太多的loginc。它有默认的 Selenium IDE 代码

<?xml version="1.0" encoding="UTF-8"?>
<!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://www.google.com/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>

</tbody></table>
</body>
</html>

【问题讨论】:

  • 你跑过这个吗?此外,如果没有您的数据文件,我们将无法重新创建。
  • 我使用 Selenium IDE 创建了脚本。我能够使用 Selenium IDE 运行脚本。我通过命令行遇到问题。

标签: selenium selenium-webdriver selenium-ide selenium-rc


【解决方案1】:

Components 对象已被弃用。它很快就会被删除。如果您尝试以下操作可能会导致:

window.open(); 

打开一个弹出窗口,但它被您的浏览器设置“阻止”。我想知道是否正在访问您的默认 Firefox 配置文件(?)您可以尝试在您的 Firefox 配置文件中允许弹出窗口。

【讨论】:

  • 我允许弹出窗口并尝试过,它没有解决该错误。
最近更新 更多