Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in loading npm modules #40

Open
maninderjeet opened this issue Aug 29, 2017 · 0 comments
Open

Issue in loading npm modules #40

maninderjeet opened this issue Aug 29, 2017 · 0 comments

Comments

@maninderjeet
Copy link

maninderjeet commented Aug 29, 2017

Following is my test.js file

load('scripts/jvm-npm.js');
var webdriverio = require('webdriverio');
var options = {
    desiredCapabilities: {
        browserName: 'chrome'
    }
};
function launchbrowser(){
	var client=webdriverio.remote(options).init();
	client.url('https://www.github.com');
	client.end();
}

But when I'm launching it through Java Nashorn its not able to find some modules. But if we go to node_modules folder everything is there.
Code for Nashorn:

public static void launchWebDriverIO() throws ScriptException, NoSuchMethodException,
			IOException {
		System.out.println("Launching WebDriver IO");
		String testjsFile = System.getProperty("user.dir") + File.separator + "scripts"
				+ File.separator + "test.js";
		ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
		engine.eval(new FileReader(testjsFile));
		Invocable invocable = (Invocable) engine;
		invocable.invokeFunction("launchbrowser");
	}

Error:

Cannot load module ../modules/es6.object.to-string LOAD_ERROR
Cannot load module core-js/library/fn/promise LOAD_ERROR
javax.script.ScriptException: Error: Cannot read file 
Cannot load module babel-runtime/core-js/promise LOAD_ERROR
Cannot load module ./lib/webdriverio LOAD_ERROR
Cannot load module webdriverio LOAD_ERROR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant