I am trying with below code.
AppiumDriverLocalService service = AppiumDriverLocalService.buildDefaultService();
service.start();
But it gives me “io.appium.java_client.service.local.InvalidNodeJSInstance: Node.js is not installed”
Is there any way I can fix this problem without passing the node path/appium js into program ?
Any help will be more Appreciated
You cannot, it is mandatory or u can say a precondition to pass node path / appium js path in this class
Thanks @amitjaincoer191 .
Is there any work around for cross platform like Windows , Mac where it can find path dynamically. I mean basically try to avoid to hardcode the path on any java or properties file.
you can handle programmatically, like check OS type and launch appium and node accordingly.
if(windows){
launch appium in windows
}else if(linux){
launch appium in linux
}else{
launch appium in MAC
}
thanks,
Priyank
You can add these path to environment variable and then read it using java code
e.g.
public void getEnviormentVariables(){
System.out.println("ANDROID_HOME : "+System.getenv(“ANDROID_HOME”));
System.out.println("PATH : "+System.getenv(“PATH”));
}
for mac I am not sure you can search if same code work, but yes we do set path like windows in mac machine also.