Hello, i have written below code expecting that it will launch iOS simulator and do the login. but getting below error.
i have installed selenium webdriver using npm install selenium-webdriver. and installation was successful. Running this script from terminal.
//“use strict”;
var webdriver = require(‘selenium-webdriver’);
var capabilities = {“appium-version”: “1.0”, platformName: “iOS”,platformVersion: “8.1”,deviceName: “iPhone 5s”,app: “the location of .app “};
var driver = new RemoteWebDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
var driver = new webdriver.Builder().
usingServer(“127.0.0.1”, 4723).
withCapabilities(capabilities).
build();
browser.init(driver).then(function() {
return driver
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATextField[1]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATextField[1]").sendKeys("user")//Enter ed User name
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIASecureTextField[1]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIASecureTextField[1]").sendKeys("User10")//Entered Password
.elementByName("Return").click()
.fin(function() {
return browser.quit();
});
}).done();
Terrminal Error message:
module.js:338
throw err;
^
Error: Cannot find module ‘selenium-webdriver’
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/Users/noimac-mini4/Documents/workspace/AppiumTest/login.js:8:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions…js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
Am i missing anything on installation side?? what else i need to do in order to use selenium webdriver (JavaScript Bindings) for mobile native app automation.
Thanks,
Akhilesh Pandey