We are trying to instantiate Appium driver for Mobile Web Browser Testing for Android and iOS on perfecto. But we are getting "cannot be cast to class" error. Detail is mentioned below:
Selenium - 4.11.0
Appium Java-Client - 8.4.0
QAF - 4.0.0-RC2
OpenJDK 17
driver.name=perfectoRemoteDriver
remote.server=https://.perfectomobile.com/nexperience/perfectomobile/wd/hub/fast
remote.port=80
perfecto.additional.capabilities={"perfecto:options":{"securityToken":"","javascriptEnabled":true,"openDeviceTimeout":5.0, "scriptName":"QAF test","platformName":"iOS","browserName":"Safari","automationName":"Appium"}}
Call new AppiumSteps.getAppiumDriver();
Should be able to create AppiumDriver based on the platformName
class org.openqa.selenium.remote.TracedCommandExecutor cannot be cast to class org.openqa.selenium.remote.HttpCommandExecutor (org.openqa.selenium.remote.TracedCommandExecutor and org.openqa.selenium.remote.HttpCommandExecutor are in unnamed module of loader 'app')
IntelliJ
Maven
com.qmetry.qaf.automation.core.AutomationError: Unable to build AppiumDriver from class com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver
at .Given the user login with credential(scenarios/E2E/e2e.feature:10)
at com.qmetry.qaf.automation.step.AppiumSteps.getAppiumDriver(AppiumSteps.java:245)
at cloud.steps.IllustrationVerificationSteps.landsOnTheLoginPage(IllustrationVerificationSteps.java:50)
at cloud.steps.CommonSteps.loginWithCredential(CommonSteps.java:39)
at com.qmetry.qaf.automation.step.JavaStep.doExecute(JavaStep.java:150)
at com.qmetry.qaf.automation.step.BaseTestStep.execute(BaseTestStep.java:149)
at com.qmetry.qaf.automation.step.StringTestStep.execute(StringTestStep.java:128)
at com.qmetry.qaf.automation.step.client.Scenario.execute(Scenario.java:174)
at com.qmetry.qaf.automation.step.client.DataDrivenScenario.scenario(DataDrivenScenario.java:66)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassCastException: class org.openqa.selenium.remote.TracedCommandExecutor cannot be cast to class org.openqa.selenium.remote.HttpCommandExecutor (org.openqa.selenium.remote.TracedCommandExecutor and org.openqa.selenium.remote.HttpCommandExecutor are in unnamed module of loader 'app')
at com.qmetry.qaf.automation.step.AppiumSteps.getAppiumDriver(AppiumSteps.java:215)
at cloud.steps.IllustrationVerificationSteps.landsOnTheLoginPage(IllustrationVerificationSteps.java:50)
at cloud.steps.CommonSteps.loginWithCredential(CommonSteps.java:39)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.qmetry.qaf.automation.step.JavaStep.doExecute(JavaStep.java:150)
at com.qmetry.qaf.automation.step.BaseTestStep.execute(BaseTestStep.java:149)
at com.qmetry.qaf.automation.step.StringTestStep.execute(StringTestStep.java:128)
at com.qmetry.qaf.automation.step.client.Scenario.execute(Scenario.java:174)
at com.qmetry.qaf.automation.step.client.DataDrivenScenario.scenario(DataDrivenScenario.java:66)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
... 3 more
try using driver with driver class instead of remote driver. For example:
driver.name=perfectoDriver
remote.server=https://<NAME>.perfectomobile.com/nexperience/perfectomobile/wd/hub/fast
perfecto.additional.capabilities={"driverClass" : "io.appium.java_client.ios.IOSDriver",\
"perfecto:options":{\
"securityToken":"<TOKEN>","javascriptEnabled":true,\
"openDeviceTimeout":5.0, \
"scriptName":"${current.testcase.name}",\
"platformName":"iOS","browserName":"Safari","automationName":"Appium"}}
Use Android driver class io.appium.java_client.android.AndroidDriver
for Android