页面工厂启动不起作用返回java.lang.IllegalStateException:无法在appium中加载缓存项

时间:2018-12-12 11:01:16

标签: java selenium appium appium-android page-factory

当我尝试访问页面对象时,出现以下错误。

我的AbstractRepo.java班:

public static WebDriver driver;

    public AbstractRepositary(WebDriver driver) {
        this.driver = driver;
        //PageFactory.initElements(driver, this);
      PageFactory.initElements(new AppiumFieldDecorator(driver), this);
    }

**
 - *Enumerator.java*
**
public class Enumerator extends  AbstractRepositary{
    public static Enumerator enumerator = null;
    public Enumerator(WebDriver driver) {
        super(driver);
        PageFactory.initElements(new AppiumFieldDecorator(driver), this);
    }

输出异常是:

    java.lang.IllegalStateException: Unable to load cache item
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:372)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:380)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:376)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:376)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:376)
    at net.sf.cglib.proxy.Enhancer.getMethods(Enhancer.java:540)

1 个答案:

答案 0 :(得分:0)

此问题已解决,但由于java-client内部调用Selenium,因此从pom.xml中删除了selenium-client。 请参阅:https://github.com/appium/java-client/issues/949