Failed to instantiate page(net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)

Failed to instantiate page(net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)

serenity-appium 在使用 serenity 1.7.4 版和 serenity cucumber 1.6.3 版时运行良好。然而,在页面使用 serenity 和 cucumber 版本 3.0.5 时出现以下错误

[main] WARN net.thucydides.core.pages.PageFactory - Failed to instantiate page of type class pageObjects.LoginPageMobile (net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)
  Given User launches "Mobile" application # starter.stepdefinitions.LoginSteps.userLaunchesApplication(java.lang.String)
      net.thucydides.core.pages.WrongPageError: The page object class pageObjects.LoginPageMobile could not be instantiated:
Failed to instantiate page (net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)

尝试过以下页面

没有 MobilePageObject

package pageObjects;

import io.appium.java_client.pagefactory.AndroidFindBy;
import net.serenitybdd.core.pages.PageObject;
import org.openqa.selenium.WebElement;

public class LoginPageMobile extends PageObject {

    @AndroidFindBy(xpath="//android.widget.Button[@text='Log In']")
    private WebElement WPLogInButton;
    public void doLogin(){
        typeInto(WPLogInButton,"test@test.com");
    }
}

使用 MobilePageObject

package pageObjects;

import com.google.common.base.Predicate;

import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import net.serenitybdd.core.pages.PageObject;
import io.appium.java_client.android.AndroidDriver;
import net.thucydides.core.webdriver.WebDriverFacade;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;

public class MobilePageObject extends PageObject {

    public MobilePageObject(final WebDriver driver) {
        super(driver, new Predicate<PageObject>() {
            @Override
            public boolean apply(PageObject page) {
                PageFactory.initElements(new AppiumFieldDecorator(((WebDriverFacade) page.getDriver()).getProxiedDriver()), page);
                return true;
            }
        });
    }

    public MobilePageObject() {
    }
}

Serenity.properties

webdriver.driver= appium
appium.hub = http://localhost:4723/wd/hub
######## android CAPS ######
appium.automationName = Appium
appium.platformName= Android
appium.platformVersion = 11.0
appium.deviceName  = emulator-5554
appium.app = serenity-cucumber-starter/src/test/resources/Calculator.apk

为页面扩展 PageObject 而不是 MobilePageObject 解决了 serenity 和 cucumber 版本 3.0.5 的问题。