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

Unable to create Appium 2.0 Session Using AppiumDriverLocalService. #2018

Closed
JYOTIPRAKASH225 opened this issue Sep 19, 2023 · 2 comments
Closed

Comments

@JYOTIPRAKASH225
Copy link

Description

While creating Appium2.0 Session Programatically using AppiumDriverLocalService Getting NullPointerException

Environment

  • Java client build version or git revision if you use some snapshot: 8.5.0
  • Appium server version or git revision if you use some snapshot: 2.1.3
  • Desktop OS/version used to run Appium if necessary: MAC OS Ventura 13.4.1
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: v20.6.0
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: Real

Details

While creating Appium2.0 Session Programatically using AppiumDriverLocalService Getting NullPointerException

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 io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:89)
at com.appium.appium2Session.getDriver(appium2Session.java:42)
at com.appium.appium2Session.main(appium2Session.java:29)

Code To Reproduce Issue [ Good To Have ]

	service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1")
			.usingPort(port).withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"))
			.withArgument(GeneralServerFlag.LOG_LEVEL, "debug"));
	DesiredCapabilities capabilities = new DesiredCapabilities();

	capabilities.setCapability("platformName", "iOS");
	capabilities.setCapability("appium:platformVersion", "15");
	capabilities.setCapability("appium:deviceName", "jyotipraksh's iPhone");
	capabilities.setCapability("appium:automationName", "XCUITest");
	capabilities.setCapability("appium:app", bundleID);
	capabilities.setCapability("appium:udid", "6279765bfc1744548bec50ddc00780049a3f155c");
	capabilities.setCapability("appium:includeSafariInWebviews", true);
	capabilities.setCapability("appium:newCommandTimeout", 3600);
	capabilities.setCapability("appium:connectHardwareKeyboard", true);

	System.out.println("Appium context set to application :" + appName);
	driver = new IOSDriver(service, capabilities);

Exception Stacktraces

(https://gist.github.com/JYOTIPRAKASH225/57d639519e62744800df3ef68300b915)

Link To Appium Logs

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 io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:89)
at com.appium.appium2Session.getDriver(appium2Session.java:42)
at com.appium.appium2Session.main(appium2Session.java:29)

@ashwithpoojary98
Copy link
Contributor

ashwithpoojary98 commented Sep 19, 2023

#2014
Please refer to this bug. The issue with the log file.

Refer below code
new AppiumServiceBuilder()
.usingAnyFreePort()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withLogFile(new File(System.getProperty("user.dir")+"appium.log"))
.withArgument(GeneralServerFlag.RELAXED_SECURITY)
.build()
.start();

@valfirst
Copy link
Collaborator

Duplicate of #2004

@valfirst valfirst marked this as a duplicate of #2004 Sep 20, 2023
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

3 participants