When I am running, appium basic test ,then error message showing

can you show BeforeClass configuration?

Next time can you post as text? Can’t copy/paste from a screenshot.

@BeforeClass
public void configuration() throws MalformedURLException {
service = new AppiumServiceBuilder()
.withAppiumJS(new File(
“C://Users//vishnudas//AppData//Roaming//npm//node_modules//appium//build//lib//main.js”))
.withIPAddress(“127.0.0.1”).usingPort(4723).build();
// service.start();
UiAutomator2Options options = new UiAutomator2Options();
options.setDeviceName(“PixbitDevice”);
options.setApp(“D://Eclipse_Automation//UserApp//src//test//java//resources//user_app.apk”);
driver = new AndroidDriver(new URL(“http://127.0.0.1:4723”), options);

you can try to add this after
.usingPort(4723).usingDriverExecutable(new File(“C:\Program Files\nodejs\node.exe”)).build();
service.start();
driver = new AndroidDriver(new URL(“http://127.0.0.1:4723”), options);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

  • upgrade your appium java-client to version 8.5.0

instead to use the constructor configure() in normaTest class try this:
public void normalTest extends (the class that contains your configuration)

1 Like

After appium client server updation,that’s working correctly

I have one more doubt

about what do you have doubt?

When i run configuration in project ,that time this error is showing

@BeforeClass
public void configuration() throws MalformedURLException {

	service = new AppiumServiceBuilder()
			.withAppiumJS(new File(
					"C://Users//vishnudas//AppData//Roaming//npm//node_modules//appium//build//lib//main.js"))
			.withIPAddress("127.0.0.1").usingPort(4723).build();
	//service.start();

	UiAutomator2Options options = new UiAutomator2Options();
	options.setDeviceName("PixbitDevice");
	options.setApp("D://Eclipse_Automation//UserApp//src//test//java//resources//user_app_staging.apk");
	driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
	driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(40));

}

java.lang.NullPointerException
at java.base/java.io.FileOutputStream.(FileOutputStream.java:226)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:184)
at org.openqa.selenium.remote.service.DriverService$Builder.getLogOutput(DriverService.java:448)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:495)
at globalfiles.GlobalData.configuration(GlobalData.java:40)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:390)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:325)
at org.testng.internal.invokers.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:180)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:122)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

do not comment this. if it still doesn’t work you can try to add to this

.usingDriverExecutable(new File(“/Users/…/.nvm/versions/node/v16.20.0/bin/node(your node path)”)).build();

with out uncomment service.start() is not work

you wrote //service.start()
you have to write service.start() without (//)

which path need to add


this is my configuration with mac

how you can see service.start() is not commented

@BeforeClass
public void configuration() throws MalformedURLException {

	service = new AppiumServiceBuilder()
			.withAppiumJS(new File(
					"C://Users//vishnudas//AppData//Roaming//npm//node_modules//appium//build//lib//main.js"))
			.withIPAddress("127.0.0.1").usingPort(4723).usingDriverExecutable(new File("C://Users//vishnudas//AppData//Roaming//nvm//v18.13.0//node.exe")).build();
	service.start();

	UiAutomator2Options options = new UiAutomator2Options();
	options.setDeviceName("PixbitDevice");
	options.setApp("D://Eclipse_Automation//UserApp//src//test//java//resources//user_app_staging.apk");
	driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
	driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(40));

}

Again it shows the same error message

first thing,
is appium started?
second thing
have you tried to add .usingDriverExecutable(new File("/Users/…/.nvm/versions/node/v16.20.0/bin/node(percorso del nodo)")).build();

usingDriverExecutable not used yet, without working , but now

appium started,but not showing any error message in appium server log

sorry i didn’t understand

Appium started Correctly !

[Appium] Welcome to Appium v2.0.1
[Appium] Attempting to load driver uiautomator2…
[debug] [Appium] Requiring driver at C:/Users/vishnudas/.appium/node_modules/appium-uiautomator2-driver
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLS in your client code to connect to this server:
[Appium] http://192.168.1.193:4723/
[Appium] http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] Available drivers:
[Appium] - [email protected] (automationName ‘UiAutomator2’)
[Appium] No plugins have been installed. Use the “appium plugin” command to install the one(s) you want to use.

and configuration use this !

@BeforeClass
public void configuration() throws MalformedURLException {

	service = new AppiumServiceBuilder()
			.withAppiumJS(new File(
					"C://Users//vishnudas//AppData//Roaming//npm//node_modules//appium//build//lib//main.js"))
			.withIPAddress("127.0.0.1").usingPort(4723).build();
	service.start();

	UiAutomator2Options options = new UiAutomator2Options();
	options.setDeviceName("PixbitDevice");
	options.setApp("D://Eclipse_Automation//UserApp//src//test//java//resources//user_app_staging.apk");
	driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
	driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(40));

}

but the error message is

FAILED CONFIGURATION: @BeforeClass globalfiles.GlobalData.configuration

java.lang.NullPointerException

at java.base/java.io.FileOutputStream.(FileOutputStream.java:226)

at java.base/java.io.FileOutputStream.(FileOutputStream.java:184)

at org.openqa.selenium.remote.service.DriverService$Builder.getLogOutput(DriverService.java:448)

at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:495)

at globalfiles.GlobalData.configuration(GlobalData.java:42)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)

at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)

at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:390)

at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:325)

at org.testng.internal.invokers.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:180)

at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:122)

at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

at org.testng.TestRunner.privateRun(TestRunner.java:848)

at org.testng.TestRunner.run(TestRunner.java:621)

at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)

at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)

at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)

at org.testng.SuiteRunner.run(SuiteRunner.java:336)

at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)

at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)

at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)

at org.testng.TestNG.runSuites(TestNG.java:1114)

at org.testng.TestNG.run(TestNG.java:1082)

at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)

at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

prove this if the error persist maybe it don’t read the right path