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

Init AppiumDriver error when i update serenity to new version 4.2.0 #3512

Open
thuonglai opened this issue Aug 19, 2024 · 12 comments
Open

Init AppiumDriver error when i update serenity to new version 4.2.0 #3512

thuonglai opened this issue Aug 19, 2024 · 12 comments

Comments

@thuonglai
Copy link

What happened?

I see error

11:21:20.143 [main] WARN net.thucydides.core.pages.PageFactory - Failed to instantiate page of type class pages.AskDocumentScreen ({})
net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver
	at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:193)
	at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:181)
	at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:132)
	at pages.BaseScreen.androidDriver(BaseScreen.java:41)
	at pages.BaseScreen.<init>(BaseScreen.java:31)
	at pages.AskDocumentScreen.<init>(AskDocumentScreen.java:6)
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
	at net.thucydides.core.pages.PageFactory.createFromSimpleConstructor(PageFactory.java:67)
	at net.thucydides.core.pages.PageFactory.createPageOfType(PageFactory.java:38)
	at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:82)
	at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:50)
	at net.serenitybdd.core.Serenity.injectDependenciesInto(Serenity.java:78)
	at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:120)
	at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:73)
	at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:56)
	at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:46)
	at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
	at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
	at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
	at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
	at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
	at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:81)
	at io.cucumber.core.runner.TestStep.run(TestStep.java:53)
	at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51)
	at io.cucumber.core.runner.TestCase.run(TestCase.java:84)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
	at io.cucumber.junit.PickleRunners$NoStepDescriptions.lambda$run$0(PickleRunners.java:151)
	at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:136)
	at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:136)
	at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:148)
	at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:144)
	at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:28)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at io.cucumber.junit.FeatureRunner.run(FeatureRunner.java:137)
	at io.cucumber.junit.CucumberSerenityBaseRunner.runChild(CucumberSerenityBaseRunner.java:332)
	at io.cucumber.junit.CucumberSerenityBaseRunner.runChild(CucumberSerenityBaseRunner.java:53)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at io.cucumber.junit.CucumberSerenityBaseRunner$RunCucumber.evaluate(CucumberSerenityBaseRunner.java:363)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: After several attempts, could not instantiate new WebDriver instance of type class io.appium.java_client.AppiumDriver (Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'AxleHires-MacBook-Pro-4.local', ip: '192.168.111.147'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.4', java.version: '18.0.1.1'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/axlehire/Documents/a..., appActivity: com.axlehire.drive.MainActi..., appPackage: com.axlehire.drive.staging, autoGrantPermissions: true, automationName: FlutterIntegration, flutterElementWaitTimeout: 10000, flutterEnableMockCamera: true, fullReset: true, hub: http://localhost:4723/wd/hub, newCommandTimeout: 3000, platformName: ANDROID, platformVersion: 14.0}]}]
Capabilities {app: /Users/axlehire/Documents/a..., appActivity: com.axlehire.drive.MainActi..., appPackage: com.axlehire.drive.staging, autoGrantPermissions: true, automationName: FlutterIntegration, flutterElementWaitTimeout: 10000, flutterEnableMockCamera: true, fullReset: true, hub: http://localhost:4723/wd/hub, newCommandTimeout: 3000, platformName: ANDROID, platformVersion: 14.0}). See below for more details.
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:184)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:170)
	at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:144)
	at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:190)
	... 59 common frames omitted
Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'AxleHires-MacBook-Pro-4.local', ip: '192.168.111.147'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.4', java.version: '18.0.1.1'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/axlehire/Documents/a..., appActivity: com.axlehire.drive.MainActi..., appPackage: com.axlehire.drive.staging, autoGrantPermissions: true, automationName: FlutterIntegration, flutterElementWaitTimeout: 10000, flutterEnableMockCamera: true, fullReset: true, hub: http://localhost:4723/wd/hub, newCommandTimeout: 3000, platformName: ANDROID, platformVersion: 14.0}]}]
Capabilities {app: /Users/axlehire/Documents/a..., appActivity: com.axlehire.drive.MainActi..., appPackage: com.axlehire.drive.staging, autoGrantPermissions: true, automationName: FlutterIntegration, flutterElementWaitTimeout: 10000, flutterEnableMockCamera: true, fullReset: true, hub: http://localhost:4723/wd/hub, newCommandTimeout: 3000, platformName: ANDROID, platformVersion: 14.0}
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:563)
	at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103)
	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:109)
	at net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newDriverUsingExternalServer(AppiumDriverProvider.java:61)
	at net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newInstance(AppiumDriverProvider.java:49)
	at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:154)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:191)
	... 67 common frames omitted
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [app, appActivity, appPackage, autoGrantPermissions, automationName, flutterElementWaitTimeout, flutterEnableMockCamera, fullReset, hub, newCommandTimeout, platformVersion]
	at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$5(NewSessionPayload.java:163)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:540)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:167)
	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:70)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:99)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:84)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:60)
	at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
	... 76 common frames omitted

What did you expect to happen?

No response

Serenity BDD version

4.2.0

JDK version

openjdk version "17.0.7" 2023-04-18 LTS OpenJDK Runtime Environment Corretto-17.0.7.7.1 (build 17.0.7+7-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.7.7.1 (build 17.0.7+7-LTS, mixed mode, sharing)

Execution environment

-MacOs 14.4

How to reproduce the bug.

AndroidDriver androidDriver() {
return (AndroidDriver)
((WebDriverFacade) getDriver()).getProxiedDriver();
}

How can we make it happen?

Work on this myself and propose a PR (with Serenity BDD team guidance)

@wakaleo
Copy link
Member

wakaleo commented Aug 19, 2024

This might be the root issue:

"Illegal key values seen in w3c capabilities: [app, appActivity, appPackage, autoGrantPermissions, automationName, flutterElementWaitTimeout, flutterEnableMockCamera, fullReset, hub, newCommandTimeout, platformVersion]"

@thuonglai
Copy link
Author

thuonglai commented Aug 19, 2024

Hi @wakaleo . When i using version 3.6.22 or 4.1.20 of serenity. This error not happen

@wakaleo
Copy link
Member

wakaleo commented Aug 19, 2024

4.2.0 uses the later version of Selenium and the Appium client - there may be upgrades in your config that you need to do related to these new versions. (There are no code changes in Serenity between 4.1.20 and 4.2.0, just library updates)

@thuonglai
Copy link
Author

Yes. When i use my custom driver. It works ok. But if i using webdriver.driver = appium, it had error.

@maalben
Copy link

maalben commented Aug 20, 2024

I have the same error, I'm using a serenity.properties file..

@wakaleo
Copy link
Member

wakaleo commented Aug 20, 2024

It is better to use the serenity.conf file, but that looks like a w3c config issue - maybe check the Appium docs

@maalben
Copy link

maalben commented Aug 20, 2024

OK, I got it. However, with the next configuration in the serenity.properties file:

serenity.project.name = Projecto Reto Automatizacion Ionix

webdriver.driver=appium
appium.hub=http://0.0.0.0:4723
appium.platformName=Android
appium.deviceName=emulator-5554
appium.automationName=UiAutomator2
appium.app=${user.dir}/src/test/resources/app/app-test-QA.apk
appium.noReset=false
appium.fullReset=false

appium.nativeWebScreenshot=true
appium.platformVersion = "12.0"
appium.appPackage = com.appqa
appium.appActivity = com.appqa.MainActivity

serenity.take.screenshots=BEFORE_AND_AFTER_EACH_STEP
serenity.dry.run=false
serenity.verbose.steps=true
serenity.report.encoding=UTF8
serenity.logging = VERBOSE
serenity.console.colors = true
serenity.reports.show.step.details = true
feature.file.encoding =UTF8
serenity.compromised.on=com.uam.automation.ionix.exceptions.ErrorElementNotFoundException

And build.gradle file:

defaultTasks 'clean', 'test', 'aggregate'

group = 'com.uam.automation.web'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    mavenLocal()
}

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "net.serenity-bdd:serenity-gradle-plugin:4.1.14"
    }
}


apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "net.serenity-bdd.serenity-gradle-plugin"


ext {
    serenity_version = '4.1.20'
    appium_version = '9.2.2'
    junit_platform_launcher_version="1.10.3"
    cucumber_junit_platform_engine_version="7.18.1"
    junit_platform_suite_version="1.10.3"
    junit_jupiter_engine_version="5.10.3"
    junit_vintage_engine_version="5.10.3"
    logback_classic_version="1.5.6"
    assertj_core_version="3.26.3"
}

dependencies {
        testImplementation "net.serenity-bdd:serenity-core:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-cucumber:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-screenplay:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-screenplay-webdriver:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-ensure:${serenity_version}"
        testImplementation "org.junit.platform:junit-platform-launcher:${junit_platform_launcher_version}"
        testImplementation "io.cucumber:cucumber-junit-platform-engine:${cucumber_junit_platform_engine_version}"
        testImplementation "org.junit.platform:junit-platform-suite:${junit_platform_suite_version}"
        testImplementation "org.junit.jupiter:junit-jupiter-engine:${junit_jupiter_engine_version}"
        testImplementation "org.junit.vintage:junit-vintage-engine:${junit_vintage_engine_version}"
        implementation "ch.qos.logback:logback-classic:${logback_classic_version}"
        testImplementation "org.assertj:assertj-core:${assertj_core_version}"
        testImplementation "io.appium:java-client:${appium_version}"
}

test {
    useJUnitPlatform()
}

gradle.startParameter.continueOnFailure = true

test.finalizedBy(aggregate)

It works !!, any problems..

But, if I update the dependencies, for example:

serenity_version = '4.2.0'
appium_version = '9.3.0'

Not works, I see the error :

net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver
	at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:193)
	at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:181)
	at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:132)
	at net.serenitybdd.core.webdriver.RemoteDriver.of(RemoteDriver.java:18)
	at net.thucydides.core.webdriver.appium.AppiumConfiguration.getTargetPlatform(AppiumConfiguration.java:55)
	at net.thucydides.core.webdriver.ElementLocatorFactorySelector.platformFor(ElementLocatorFactorySelector.java:52)
	at net.thucydides.core.webdriver.ElementLocatorFactorySelector.getLocatorFor(ElementLocatorFactorySelector.java:42)
	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:20)
	at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:170)
	at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:174)
	at net.serenitybdd.core.pages.PageObject.<init>(PageObject.java:156)
	at net.serenitybdd.screenplay.abilities.BrowseTheWeb.<init>(BrowseTheWeb.java:32)
	at net.serenitybdd.screenplay.abilities.BrowseTheWeb.with(BrowseTheWeb.java:48)
	at com.uam.automation.web.stepdefinitions.LoginStepDefinitions.setup(LoginStepDefinitions.java:36)
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: After several attempts, could not instantiate new WebDriver instance of type class io.appium.java_client.AppiumDriver (Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Marios-MacBook-Pro.local', ip: 'fe80:0:0:0:1081:3168:1d1d:f1cf%en0'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.6.9', java.version: '21.0.2'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}]}]
Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}). See below for more details.
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:184)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:170)
	at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:144)
	at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:190)
	at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:181)
	at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:132)
	at net.serenitybdd.core.webdriver.RemoteDriver.of(RemoteDriver.java:18)
	at net.thucydides.core.webdriver.appium.AppiumConfiguration.getTargetPlatform(AppiumConfiguration.java:55)
	at net.thucydides.core.webdriver.ElementLocatorFactorySelector.platformFor(ElementLocatorFactorySelector.java:52)
	at net.thucydides.core.webdriver.ElementLocatorFactorySelector.getLocatorFor(ElementLocatorFactorySelector.java:42)
	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:20)
	at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:170)
	at net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:174)
	at net.serenitybdd.core.pages.PageObject.<init>(PageObject.java:156)
	at net.serenitybdd.screenplay.abilities.BrowseTheWeb.<init>(BrowseTheWeb.java:32)
	at net.serenitybdd.screenplay.abilities.BrowseTheWeb.with(BrowseTheWeb.java:48)
	at com.uam.automation.web.stepdefinitions.LoginStepDefinitions.setup(LoginStepDefinitions.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
	at io.cucumber.java.Invoker.invoke(Invoker.java:24)
	at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
	at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:64)
	at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
	at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
	at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
	at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:81)
	at io.cucumber.core.runner.TestStep.run(TestStep.java:53)
	at io.cucumber.core.runner.TestCase.run(TestCase.java:78)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
	at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.lambda$runTestCase$4(CucumberEngineExecutionContext.java:112)
	at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:136)
	at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:136)
	at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.runTestCase(CucumberEngineExecutionContext.java:109)
	at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:168)
	at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:90)
	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Marios-MacBook-Pro.local', ip: 'fe80:0:0:0:1081:3168:1d1d:f1cf%en0'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.6.9', java.version: '21.0.2'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}]}]
Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:563)
	at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103)
	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:109)
	at net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newDriverUsingExternalServer(AppiumDriverProvider.java:61)
	at net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newInstance(AppiumDriverProvider.java:49)
	at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:154)
	at net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:191)
	... 48 more
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [app, appActivity, appPackage, automationName, deviceName, fullReset, hub, nativeWebScreenshot, noReset, platformVersion]
	at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$5(NewSessionPayload.java:163)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:540)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:167)
	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:70)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:99)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:84)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:60)
	at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
	... 57 more


After several attempts, could not instantiate new WebDriver instance of type class io.appium.java_client.AppiumDriver (Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Marios-MacBook-Pro.local', ip: 'fe80:0:0:0:1081:3168:1d1d:f1cf%en0'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.6.9', java.version: '21.0.2'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}]}]
Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}). See below for more details.
net.thucydides.core.webdriver.DriverConfigurationError: After several attempts, could not instantiate new WebDriver instance of type class io.appium.java_client.AppiumDriver (Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Marios-MacBook-Pro.local', ip: 'fe80:0:0:0:1081:3168:1d1d:f1cf%en0'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.6.9', java.version: '21.0.2'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}]}]
Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}). See below for more details.
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:184)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:195)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:170)
	at app//net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:144)
	at app//net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:190)
	at app//net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:181)
	at app//net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:132)
	at app//net.serenitybdd.core.webdriver.RemoteDriver.of(RemoteDriver.java:18)
	at app//net.thucydides.core.webdriver.appium.AppiumConfiguration.getTargetPlatform(AppiumConfiguration.java:55)
	at app//net.thucydides.core.webdriver.ElementLocatorFactorySelector.platformFor(ElementLocatorFactorySelector.java:52)
	at app//net.thucydides.core.webdriver.ElementLocatorFactorySelector.getLocatorFor(ElementLocatorFactorySelector.java:42)
	at app//net.thucydides.core.webdriver.ElementLocatorFactorySelector.getLocatorFor(ElementLocatorFactorySelector.java:31)
	at app//net.thucydides.core.annotations.locators.SmartElementProxyCreator.proxyElements(SmartElementProxyCreator.java:21)
	at app//net.thucydides.core.webdriver.DefaultPageObjectInitialiser.apply(DefaultPageObjectInitialiser.java:20)
	at app//net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:170)
	at app//net.serenitybdd.core.pages.PageObject.setDriver(PageObject.java:174)
	at app//net.serenitybdd.core.pages.PageObject.<init>(PageObject.java:156)
	at app//net.serenitybdd.screenplay.abilities.BrowseTheWeb.<init>(BrowseTheWeb.java:32)
	at app//net.serenitybdd.screenplay.abilities.BrowseTheWeb.with(BrowseTheWeb.java:48)
	at app//com.uam.automation.web.stepdefinitions.LoginStepDefinitions.setup(LoginStepDefinitions.java:36)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
	at app//io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
	at app//io.cucumber.java.Invoker.invoke(Invoker.java:24)
	at app//io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
	at app//io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:64)
	at app//io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
	at app//io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
	at app//io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
	at app//io.cucumber.core.runner.TestStep.executeStep(TestStep.java:81)
	at app//io.cucumber.core.runner.TestStep.run(TestStep.java:53)
	at app//io.cucumber.core.runner.TestCase.run(TestCase.java:78)
	at app//io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
	at app//io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.lambda$runTestCase$4(CucumberEngineExecutionContext.java:112)
	at app//io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:136)
	at app//io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
	at app//io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:136)
	at app//io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.runTestCase(CucumberEngineExecutionContext.java:109)
	at app//io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:168)
	at app//io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:90)
	at [email protected]/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at [email protected]/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
	at [email protected]/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at [email protected]/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at [email protected]/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at [email protected]/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Marios-MacBook-Pro.local', ip: 'fe80:0:0:0:1081:3168:1d1d:f1cf%en0'
Build info: version: '4.23.1', revision: '656257d8e9'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.6.9', java.version: '21.0.2'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}]}]
Capabilities {app: /Users/mariobenitez/DevAutP..., appActivity: com.appqa.MainActivity, appPackage: com.appqa, automationName: UiAutomator2, deviceName: emulator-5554, fullReset: false, hub: http://0.0.0.0:4723, nativeWebScreenshot: true, noReset: false, platformName: ANDROID, platformVersion: "12.0"}
	at app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:563)
	at app//io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
	at app//org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
	at app//io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91)
	at app//io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103)
	at app//io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:109)
	at app//net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newDriverUsingExternalServer(AppiumDriverProvider.java:61)
	at app//net.serenitybdd.core.webdriver.driverproviders.AppiumDriverProvider.newInstance(AppiumDriverProvider.java:49)
	at app//net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:154)
	at app//net.thucydides.core.webdriver.WebDriverFactory.waitThenRetry(WebDriverFactory.java:191)
	... 48 more
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [app, appActivity, appPackage, automationName, deviceName, fullReset, hub, nativeWebScreenshot, noReset, platformVersion]
	at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$5(NewSessionPayload.java:163)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:540)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:167)
	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:70)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:99)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:84)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:60)
	at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
	... 57 more

I can't to update the dependencies version....

What can happened here ???? :-(

@wakaleo
Copy link
Member

wakaleo commented Aug 20, 2024

I suspect Selenium or Appium may be stricter in the w3C standards in the latest versions. Try with serenity.conf instead of serenity.properties. Check the w3C documentation to make sure all the options you have configured are legal. Have a look at the driver creation logic to see what is being passed through to Appium (this hasn't changed in Serenity so I suspect Appium or Selenium are more strict now).

@maalben
Copy link

maalben commented Aug 20, 2024

I have made the change by adding the serenity.conf file, however, I continue to have exactly the same problem. I have deleted the serenity.properties file.

serenity.conf

webdriver {
  driver = "appium"
}

appium {
  app = "${user.dir}/src/test/resources/app/app-test-QA.apk"
  hub = "http://localhost:4723"
  platformName = "Android"
  deviceName = "emulator-5554"
  platformVersion = "12.0"
  automationName = "UiAutomator2"
  autoGrantPermissions = true
  autoAcceptAlerts = true
  appPackage = "com.appqa"
  appActivity = "com.appqa.MainActivity"
  nativeWebScreenshot = true
}

build.gradle:

defaultTasks 'clean', 'test', 'aggregate'

group = 'com.uam.automation.web'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    mavenLocal()
}

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "net.serenity-bdd:serenity-gradle-plugin:4.1.14"
    }
}


apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "net.serenity-bdd.serenity-gradle-plugin"


ext {
    serenity_version = '4.2.0'
    appium_version = '9.3.0'
    junit_platform_launcher_version="1.10.3"
    cucumber_junit_platform_engine_version="7.18.1"
    junit_platform_suite_version="1.10.3"
    junit_jupiter_engine_version="5.10.3"
    junit_vintage_engine_version="5.10.3"
    logback_classic_version="1.5.6"
    assertj_core_version="3.26.3"
}

dependencies {
        testImplementation "net.serenity-bdd:serenity-core:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-cucumber:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-screenplay:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-screenplay-webdriver:${serenity_version}"
        testImplementation "net.serenity-bdd:serenity-ensure:${serenity_version}"
        testImplementation "org.junit.platform:junit-platform-launcher:${junit_platform_launcher_version}"
        testImplementation "io.cucumber:cucumber-junit-platform-engine:${cucumber_junit_platform_engine_version}"
        testImplementation "org.junit.platform:junit-platform-suite:${junit_platform_suite_version}"
        testImplementation "org.junit.jupiter:junit-jupiter-engine:${junit_jupiter_engine_version}"
        testImplementation "org.junit.vintage:junit-vintage-engine:${junit_vintage_engine_version}"
        implementation "ch.qos.logback:logback-classic:${logback_classic_version}"
        testImplementation "org.assertj:assertj-core:${assertj_core_version}"
        testImplementation "io.appium:java-client:${appium_version}"
}

test {
    useJUnitPlatform()
}

gradle.startParameter.continueOnFailure = true

test.finalizedBy(aggregate)

@janmekota
Copy link

janmekota commented Sep 16, 2024

@maalben
Hi Mario, I am using

  • net.serenity-bdd:serenity-core:4.1.4
  • io.appium:java-client:9.2.3

All capabilities with prefix appium must be listed in appium.additional.capabilities and appium.process.desired.capabilities=true must be set.
I set the capabilities by java properties -D
E.g.

-Dappium.hub=http://localhost:4723
-Dappium.additional.capabilities=app,appPackage,appWaitActivity,autoLaunch,automationName,dontStopAppOnReset,hub,newCommandTimeout,noReset,platformVersion,showChromedriverLog,systemPort,udid,adbExecTimeout,androidInstallTimeout
-Dappium.app=...
-Dappium.appPackage=...
-Dappium.appWaitActivity=...
-Dappium.autoLaunch=false
-Dappium.automationName=uiautomator2
-Dappium.dontStopAppOnReset=true
-Dappium.newCommandTimeout=180
-Dappium.noReset=true
-Dappium.platformName=Android
-Dappium.process.desired.capabilities=true
-Dappium.showChromedriverLog=true
-Dserenity.outputDirectory=target/site/report_for_device
-Dwebdriver.driver=appium
-Dwebdriver.timeouts.implicitlywait=0
-Dappium.adbExecTimeout=200000
-Dappium.androidInstallTimeout=200000

But probably the same can be done in serenity.conf:

webdriver {
  driver = "appium"
}

appium {
  additional.capabilities = app,appActivity,appPackage,automationName,deviceName,fullReset,hub,nativeWebScreenshot,noReset,platformVersion
  process.desired.capabilities=true
  app = "${user.dir}/src/test/resources/app/app-test-QA.apk"
  hub = "http://localhost:4723"
  platformName = "Android"
  deviceName = "emulator-5554"
  platformVersion = "12.0"
  automationName = "UiAutomator2"
  autoGrantPermissions = true
  autoAcceptAlerts = true
  appPackage = "com.appqa"
  appActivity = "com.appqa.MainActivity"
  nativeWebScreenshot = true
}

@maalben
Copy link

maalben commented Sep 16, 2024

@maalben Hi Mario, I am using

  • net.serenity-bdd:serenity-core:4.1.4
  • io.appium:java-client:9.2.3

All capabilities with prefix appium must be listed in appium.additional.capabilities. I set the capabilities by java properties -D E.g.

-Dappium.hub=http://localhost:4723
-Dappium.additional.capabilities=app,appPackage,appWaitActivity,autoLaunch,automationName,dontStopAppOnReset,hub,newCommandTimeout,noReset,platformVersion,showChromedriverLog,systemPort,udid,adbExecTimeout,androidInstallTimeout
-Dappium.app=...
-Dappium.appPackage=...
-Dappium.appWaitActivity=...
-Dappium.autoLaunch=false
-Dappium.automationName=uiautomator2
-Dappium.dontStopAppOnReset=true
-Dappium.newCommandTimeout=180
-Dappium.noReset=true
-Dappium.platformName=Android
-Dappium.process.desired.capabilities=true
-Dappium.showChromedriverLog=true
-Dserenity.outputDirectory=target/site/report_for_device
-Dwebdriver.driver=appium
-Dwebdriver.timeouts.implicitlywait=0
-Dappium.adbExecTimeout=200000
-Dappium.androidInstallTimeout=200000

But probably the same can be done in serenity.conf:

webdriver {
  driver = "appium"
}

appium {
  additional.capabilities = app, appActivity, appPackage, automationName, deviceName, fullReset, hub, nativeWebScreenshot, noReset, platformVersion
  app = "${user.dir}/src/test/resources/app/app-test-QA.apk"
  hub = "http://localhost:4723"
  platformName = "Android"
  deviceName = "emulator-5554"
  platformVersion = "12.0"
  automationName = "UiAutomator2"
  autoGrantPermissions = true
  autoAcceptAlerts = true
  appPackage = "com.appqa"
  appActivity = "com.appqa.MainActivity"
  nativeWebScreenshot = true
}

Hello @janmekota !!!

I have a question, the capabilities in java properties works ? And your answer is true, yoo could share a example how you implements it ?, with the last version appium and serenity...

Thanks in advanced ...

@janmekota
Copy link

I am unfamiliar with serenity.conf, but this src/test/resources/serenity.properties works for me.
You should be able to transform it to serenity.conf.

serenity.properties:

webdriver.driver= appium
appium.hub=http://localhost:4723
appium.additional.capabilities=app,appPackage,appWaitActivity,autoLaunch,automationName,dontStopAppOnReset,hub,newCommandTimeout,noReset,platformVersion,showChromedriverLog,systemPort,udid,adbExecTimeout,androidInstallTimeout
appium.app=app-dev-latest-signed.apk
appium.appPackage=com.package
appium.appWaitActivity=com.package.*
appium.autoLaunch=false
appium.automationName=uiautomator2
appium.dontStopAppOnReset=true
appium.newCommandTimeout=180
appium.noReset=true
appium.platformName=Android
appium.process.desired.capabilities=true
appium.showChromedriverLog=true
serenity.outputDirectory=target/site/report_for_device
webdriver.timeouts.implicitlywait=0
appium.adbExecTimeout=200000
appium.androidInstallTimeout=200000

There are some properties, which may not be necessary in your case.

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

4 participants