I'm automating Chrome on Windows 8.1 with JavaScript using Selenium's WebDriverJS. I downloaded a copy of the ChromeDriver and Selenium Standalone Server jar file and placed in E:\Selenium
directory. I started Selenium Standalone Server and tried to run my javascript code written in BrowserTest.js
file with Node command prompt as
E:\Selenium> Node BrowserTest.js
the 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();
But it throws error as:
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.readFileSync (fs.js:352:15)
at Object.Context.closure.goog.retrieveAndExecModule_ (E:\Selenium\node_modules\selenium-webdriver\_base.js:129:23)
at <anonymous>: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)
Problem was solved by updating to version - 2.46.1