0
我是初學者。廣東話電話go_home_page
在test.js導入類中的不可調用函數
// test.js
var homePage = require('./home_page');
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('firefox')
.build();
home = new homePage(driver);
home.go_home_page();
// home_page.js
class homePage{
constructor(driver){
this.driver = driver;
}
go_home_page(){
this.driver.get("https://www.google.com/");
}
}
TypeError: homePage is not a constructor
我怎麼能說go_home_page()
採用進口和類?
你不應該用'module.exports'首先從'home_page.js' – demouser123
由於出口模塊!你救了我的命! – Andrey76ru
我已將它添加爲答案。請upvote並接受:) – demouser123