-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