ExceptionI while trying to Initialise Page factory with Java client 6.0.0
Description
While trying to initialise Page factory using below code we are getting java.lang.ExceptionInInitializerError exception
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
Environment
- java client build version or git revision if you use some shapshot: 6.0.0
- Appium server version or git revision if you use some shapshot:1.8.1
- Desktop OS/version used to run Appium if necessary: 1.6.2
- Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
- Mobile platform/version under test: iOS 11.0.1
- Real device or emulator/simulator: real device
Details
With Java client 5.0.0 it is working fine.
Code To Reproduce Issue [ Good To Have ]
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
Ecxeption stacktraces
Please create a gist with pasted stacktrace of exception thrown by java.
java.lang.ExceptionInInitializerError
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:52)
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:33)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:217)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.access$0(AppiumFieldDecorator.java:215)
at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:107)
at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:62)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:155)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:113)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:105)
at com.greatWest.pageObject.LoginPage.
Link to Appium logs
Remove maven dependency for selenium WebDriver and started working. Internally Java-client now call selenium webdriver..
@Sidd' But I am not using Selenium WebDriver as dependancy :(
@Siddh010 Even I am facing the same issue. Have implemented page factory model in the project but exception occurs the moment my class get initialized.
I have updated the selenium-server, selenium-java to Version 3.13 and my appium java-client to Version 6.1.0. Appium 1.8.1 is being used.
Any help would be appreciated.
@narendra-chandratre @kapilsuri87 check if you're using cucumber (cukes). I solved it by removing that dependency
@jpita : Please confirm if you want me to update all cucumber dependencies from "info.cukes" to "io.cucumber" dependencies??
I just deleted them, I don't need them
But I have implemented cucumber as a BDD framework. Can not really delete the same.
Also, not sure what dependencies are going to resolve by deleting the cucumber maven dependencies.
is there any resolution to this issue? Please reply.
The only way I could resolve the issue was to use webElement and not mobileElement.
set your android driver like this 'private AndroidDriver < WebElement > driver = null;' and degrade java-client to 7.4.1. your issue will be resolved.
For me @Siddh010 Solution worked. Thanks heaps mate
Hi, Am Still facing the same issue.
Dependencies:
- Java-client am using 7.4.1
- TestNg: 7.4.0
Declared driver as "public AndroidDriver
In Page class: public class LoginPage extends MobileBase { public LoginPage() { PageFactory.initElements(new AppiumFieldDecorator(mDriver), this); }
But no luck. Could some one provide workable solution.
hi guys please help me . i'm getting this exception i'm using java client 8.2.0 java.lang.ExceptionInInitializerError at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:52) at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:33) at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:217) at io.appium.java_client.pagefactory.AppiumFieldDecorator.access$0(AppiumFieldDecorator.java:215) at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:107) at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:62) at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:155) at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:113) at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:105) at com.greatWest.pageObject.LoginPage.(LoginPage.java:82)