TypeError: object is not a function - what am I doing wrong?
TypeError: object is not a function - what am I doing wrong?
我正在尝试使用页面对象进行非常简单的测试,但我立即遇到了 "login.get is not a function" 错误。
我只复制了一小部分代码,因为其他的都差不多
//login_pageObject.js
let loginContainer = function() {
this.get = function() {
browser.get("https://www.test/login.html");
};
module.exports = new loginContainer();
};
//login.js
let login = require('../page_objects/login_pageObject.js');
describe("login_logout autotests", () => {
beforeEach(() => {
browser.ignoreSynchronization = true;
});
fit("should navigate to the Login Page", () => {
login.get();
});
所以,当我 运行 它时,我有一个 "login.get is not a function" 错误。
哪里错了?
module.exports
应该在函数之外,文件的最后一行
我正在尝试使用页面对象进行非常简单的测试,但我立即遇到了 "login.get is not a function" 错误。
我只复制了一小部分代码,因为其他的都差不多
//login_pageObject.js
let loginContainer = function() {
this.get = function() {
browser.get("https://www.test/login.html");
};
module.exports = new loginContainer();
};
//login.js
let login = require('../page_objects/login_pageObject.js');
describe("login_logout autotests", () => {
beforeEach(() => {
browser.ignoreSynchronization = true;
});
fit("should navigate to the Login Page", () => {
login.get();
});
所以,当我 运行 它时,我有一个 "login.get is not a function" 错误。 哪里错了?
module.exports
应该在函数之外,文件的最后一行