selenium-chromedriver - Nightwatch.js - 无法使用反射定义类
问题描述
这个错误是什么意思?我似乎在这上面找不到任何其他东西......我在chromedriver
根目录selenium-server-standalone
的bin
文件夹中。提前致谢
Starting selenium server... started - PID: 33239
[Sample Tests] Test Suite
=============================
Running: Google Header
INFO Request: POST /wd/hub/session
- data: {"desiredCapabilities":{"browserName":"chrome","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","chromeOptions":{"args":["start-maximized"]},"name":"Sample Tests"}}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":179}
ERROR Response 500 POST /wd/hub/session (4666ms) { value:
{ message: 'Cannot define class using reflection',
error: 'unknown error' },
status: 13 }
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message: 'Cannot define class using reflection',
error: 'unknown error' },
status: 13 }
nightwatch.json:
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "./bin/selenium-server-standalone-3.8.1.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled" : true,
"acceptSslCerts" : true,
"chromeOptions" : {
"args" : ["start-maximized"]
}
}
}
}
sample_tests.js(我配置时的占位符测试)
module.exports = {
'Google Header'(client) {
client
.url('http://www.google.com')
.waitForElementVisible('.header h1')
.expect.element('.main').to.not.be.present;
client.end();
}
}
解决方案
当我刷新我的机器并最终安装 Java 10 时,我遇到了这个问题。我们团队的其他成员仍然使用 Java 9,它对他们来说工作得很好。我没有降级到 Java 9,而是从 selenium-server-standalone-3.8.1 更新到 selenium-server-standalone-3.12.0 和 chromedriver2.38 -> chromedriver2.40。
希望同样的事情对你有用。
推荐阅读
- arduino - ESP8266 Httpclient get 方法有效,但不适用于 mfrc522
- scala - sbt 运行错误:java.lang.RuntimeException:非零退出代码:1
- python - 如何在 Python 中不等待线程完成
- parsing - FParsec:如何保存解析器成功的文本
- jquery - 使用 jQuery 删除图像时,参数不显示文件字段键
- python - 如何在 tensorflow 的源代码中打印(跟踪)
- oracle - 视图内表格的完整提示
- android - appcompat 版本出现错误
- linux - Linux 正则表达式不适用于 AWK
- macos - 如何在 MAC OS 的启动时启用 pfctl