I am currently learning Selenium Webdriver. I am facing an issue where I can't run a script with imported classes, but I am able to run it without classes using import functions only. To execute it, I use babel-cli in the following manner:
node ./babel-cli/bin/babel-node.js --presets node6 ./test.js
//test.js
import homePage from "./home_page"
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('firefox')
.build();
home_page = new HomePage(driver);
home_page.goHomePage();
//home_page.js
export default class HomePage{
constructor(driver){
this.driver = driver;
}
goHomePage = function(){
this.driver.get("https://www.google.com/");
}
}
The error message displayed is:
home_page.js: Unexpected token (5:15)