-1
我尝试使用硒和关键字by
,访问类,并出现以下错误:引用错误通过没有定义
ReferenceError: By is not defined
at Object.<anonymous> (C:\selenium\hello_world.js:11:18)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
程序是非常简单的
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
var client = webdriverio.remote(options);
client
.init()
.url('https://mail.google.com')
.findElement(By.className("TnvOCe k6Zj8d XraQ3b")).click()
.end();
这似乎是Node.js,是吗?它看起来像你混淆了不同语言的功能乍一看 – mrfreester
@mrfreester是... – jamijam