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

Could not instantiate class io.appium.java_client.AppiumDriver #2763

Open
sumit-global opened this issue Mar 31, 2022 · 1 comment
Open

Could not instantiate class io.appium.java_client.AppiumDriver #2763

sumit-global opened this issue Mar 31, 2022 · 1 comment

Comments

@sumit-global
Copy link

sumit-global commented Mar 31, 2022

Hi

I know it's not correct platform to dicuss this but I checked almost all channles but didn't get a resolution so posting here.

I am not able to instantiate appium driver.

Below is my serenity.properties file
webdriver.driver= appium
appium.hub = http://127.0.0.1:4723/wd/hub
####### Android CAPS ######
appium.automationName=uiautomator2
appium.platformName = Android
appium.platformVersion = 11.0
appium.deviceName = Nexus 5X
appium.app = ${user.dir}\\org.wordpress.android_8.1.apk
appium.appActivity = org.wordpress.android.ui.accounts.LoginActivity

Runner Class

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
features = "src/test/resources/features/", tags = "@test",
monochrome = true,
plugin = {"pretty", "html:target/cucumber-reports", "json:target/cucumber.json", "rerun:target/failedRerun.txt"})
public class WordPressAppCucumber {
@BeforeClass
public static void startAppium() {startAppiumServer();}
@AfterClass
public static void stopAppium() {stopAppiumServer();}
}`

PageClass

public class WordPressLoginPage extends PageObject {

public WordPressLoginPage(WebDriver driver) {
super(driver);
}

@AndroidFindBy(id="org.wordpress.android:id/login_button")
@iOSXCUITFindBy(xpath="//XCUIElementTypeButton[@label='Log In']")
private WebElement WPLogInButton;

public void gotoWPLoginPage(){
getDriver();
element(WPLogInButton).click();
}

Everytime I am getting below exception

[main] WARN net.thucydides.core.pages.PageFactory - Failed to instantiate page of type class com.serenity.appium.poc.pages.WordPressLoginPage ({})
net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:144)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:132)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:102)
at net.serenitybdd.core.webdriver.RemoteDriver.of(RemoteDriver.java:13)
at net.thucydides.core.webdriver.appium.AppiumConfiguration.getTargetPlatform(AppiumConfiguration.java:55)
at net.thucydides.core.webdriver.ElementLocatorFactorySelector.platformFor(ElementLocatorFactorySelector.java:51)
at net.thucydides.core.webdriver.ElementLocatorFactorySelector.getLocatorFor(ElementLocatorFactorySelector.java:41)
at net.thucydides.core.webdriver.ElementLocatorFactorySelector.getLocatorFor(ElementLocatorFactorySelector.java:31)
at net.thucydides.core.annotations.locators.SmartElementProxyCreator.proxyElements(SmartElementProxyCreator.java:21)
at net.thucydides.core.webdriver.DefaultPageObjectInitialiser.apply(DefaultPageObjectInitialiser.java:19)
at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:162)
at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:166)

Could you please help here @wakaleo

@nmilosevic
Copy link

Try using appium.hub = http://127.0.0.1:4723/ instead of appium.hub = http://127.0.0.1:4723/wd/hub.

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

2 participants