I'm automating Chrome on Windows 8.1 with JavaScript using Selenium's WebDriverJS.
1) To get started with WebDriverJS for Node, I downloaded a copy of the ChromeDriver and selenium-server-standalone jar file and placed them in E:\Selenium directory.
2) I wrote the following BrowserTest.js
var driver = require("selenium-webdriver");
function createDriver() {
var driver = new driver.Builder()
.usingServer('http://localhost:4444/wd/hub')
.withCapabilities(driver.Capabilities.chrome())
.build();
driver.manage().timeouts().setScriptTimeout(10000);
return driver;
}
var driver = createDriver();
driver.get("http://www.google.com");
driver.getTitle().then(function (title) {
console.log(title);
});
driver.quit();
3) Then I started Selenium Standalone Server, and tried to run my js code:
E:\Selenium> Node BrowserTest.js
But it throws the following error:
E:\Selenium> node BrowserTest.js
fs.js:500 return binding.open(pathModule.makeLong(path), stringToFlags(flags), mode); ^ Error: ENOENT, no such file or directory 'E:\Selenium\webdriver\logging.js' at Error (native) at Object.fs.openSync (fs.js:500:18) at Object.fs.readFileSyn > (fs.js:352:15) at Object.Context.closure.goog.retrieveAndExecModule (E:\Selenium\node_modu les\selenium-webdriver_base.js:129:23) at :1:6 at Object.exports.runInContext (vm.js:64:17) at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (E:\Selenium\node_modules\selenium-webdriver_base.js:101:12) at Object.goog.importScript_ (E:\Selenium\node_modules\selenium-webdriver\lib\goog\base.js:873:9) at Object.goog.importModule_ (E:\Selenium\node_modules\selenium-webdriver\lib\goog\base.js:894:14) at Object.goog.writeScripts_ (E:\Selenium\node_modules\selenium-webdriver\lib\goog\base.js:1251:16)
Please tell me how to resolve the Error.