Unable to run the appium test with junit test runner using 2.0.0-beta.40 Appium Server

Hi Guys, I ran into this issue recently where-in am trying to run my suite through test runner but unfortunately am getting this error, I tried to downgrade appium server but didn’t help, a similar issue has been raised by multiple people but not specific with JUNIT test runner ( https://github.com/appium/java-client/issues/1619 ), I am able to start the appium server but it fails at the

   PageFactory.initElements(new AppiumFieldDecorator(driver), this);

with java.lang.ExceptionInInitializerError

IMP NOTE ---- I am able to run the individual cucumber features successfully but can’t run only with test runner, I compared the capabilities as well but not sure what’s wrong, I could really use expertise from this group to help me out on this issue, I am completely stuck at this moment.

Details :

appium java-client - 8.0.0
selenium-java - 4.0.0-beta-4
Appium server - 2.0.0-beta.40
[email protected]
[email protected]
Java - 8
Node - v18.7.0

java.lang.ExceptionInInitializerError
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:53)
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:33)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:209)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.access$000(AppiumFieldDecorator.java:61)
at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:100)
at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:63)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:147)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:110)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:102)

you can try jdk 11 and latest java-client.

Thank you so much @ido_oserovitz, After updating to JDK 11 and java client to 8.2.0, the Error has gone now but for some reason am getting driver as null while executing After() hooks

“java.lang.NullPointerException at BaseHooks.java:69”

This is simple After hook code

After("@App", () -> {
driver.quit();
});

Issue Resolved - it was an issue with the tag, Thanks once again @ido_oserovitz

1 Like