qmetry / qaf

Quality Automation Framework for web, mobileweb, mobile native and rest web-service using Selenium, webdrier, TestNG and Java Jersey
https://qmetry.github.io/qaf
MIT License
253 stars 137 forks source link

Unable to create driver instance for appium with pCloudy as a cloud integrator #457

Open rohitvatta opened 7 months ago

rohitvatta commented 7 months ago

QAF Version

Note: only the latest version is supported

Steps To Reproduce

1.  Create a simple QAF test to interact with app
2. Add following to your testng.xml 
<test name="Demo Application in Real Android Phone " enabled="true" thread-count="10">
    <parameter name="scenario.file.loc" value="src/main/resources/scenarios" />
    <parameter name="env.resources" value="src/test/resources/platform;src/test/resources/locators/android" />
    <parameter name="step.provider.pkg" value="com.poc" />
    <parameter name="remote.server" value="https://yourcloudname.pcloudy.com/appiumcloud/wd/hub"/>
    <parameter name="driver.name" value="appiumDriver"/>
    <parameter name="appium.capabilities.driverClass" value="io.appium.java_client.android.AndroidDriver"/>
    <parameter name="appium.capabilities.newCommandTimeout" value="600"/>
    <parameter name="appium.capabilities.launchTimeout" value="9000"/>
    <parameter name="appium.capabilities.platformVersion" value="14.0.0"/>
    <parameter name="appium.capabilities.platformName" value="Android"/>
    <parameter name="appium.capabilities.automationName" value="uiautomator2"/>
    <parameter name="appium.capabilities.appPackage" value="com.pcloudy.appiumdemo"/>
    <parameter name="appium.capabilities.appActivity" value="com.ba.mobile.LaunchActivity"/>
    <parameter name="appium.capabilities.pCloudy_ApplicationName" value="pCloudyAppiumDemo.apk"/>
    <parameter name="appium.additional.capabilities" value="{'appium:pCloudy_Username':'yourregisteredemail', 'appium:pCloudy_ApiKey':'yourkey', 'appium:pCloudy_DurationInMinutes': '10', 'appium:pCloudy_DeviceManufacturer':'SAMSUNG','appium:pCloudy_DeviceVersion':'14.0.0', 'appium:pCloudy_ApplicationName':'pCloudyAppiumDemo.apk', 'appium:pCloudy_WildNet': 'false','appium:pCloudy_EnableVideo': 'true', 'appium:pCloudy_EnablePerformanceData': 'true', 'appium:pCloudy_EnableDeviceLogs': 'true', 'appium:appiumVersion': '2.0.0'}"/>
    <parameter name="appium.init.retry.timeout" value="60"/>
    <groups>
        <run>
            <include name="@Demo1"/>
        </run>
    </groups>
    <classes>
        <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory"/>
    </classes>
</test>
3. Run the test and you will see the application would auto open however an exception will be thrown.

Expected behavior

No exception should be thrown after application is opened

Actual behavior

"C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64440,suspend=y,server=n -ea -Dorg.uncommons.reportng.xml-dialect=testng -Dorg.uncommons.reportng.escape-output=false -Dlog4j.configuration=src/main/resources/log4j.properties -DoutputDir=test-results/11_Apr_2024_07_55_AM -Dtest.results.dir=test-results/11_Apr_2024_07_55_AM/html -Djson.report.root.dir=test-results -Djson.report.dir=test-results/11_Apr_2024_07_55_AM/json -Dselenium.screenshots.dir=test-results/11_Apr_2024_07_55_AM/img -Dselenium.screenshots.relative.path=../img -Didea.test.cyclic.buffer.size=1048576 -javaagent:C:\Users\Rohit.Vatta\AppData\Local\JetBrains\IdeaIC2023.1\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath C:\Users\Rohit.Vatta\AppData\Local\Temp\classpath1956587385.jar com.intellij.rt.testng.RemoteTestNGStarter -usedefaultlisteners false -socket64439 @w@C:\Users\Rohit.Vatta\AppData\Local\Temp\idea_working_dirs_testng.tmp -temp C:\Users\Rohit.Vatta\AppData\Local\Temp\idea_testng.tmp Connected to the target VM, address: '127.0.0.1:64440', transport: 'socket' log4j:WARN No appenders could be found for logger (com.qmetry.qaf.automation.testng.pro.QAFAnnotationTransformer2). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Added "QAFMethodSelector" include groups [@Demo1] exclude groups: [] Scanarios location: src/main/resources/scenarios Apr 11, 2024 8:03:16 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 INFO: Detected dialect: W3C com.qmetry.qaf.automation.core.AutomationError: Unable to Create Driver Instance for appium: com/qmetry/qaf/automation/ui/webdriver/QAFExtendedWebElement$JsonConvertor at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.standardConnect(UiDriverFactory.java:442) at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.getDriver(UiDriverFactory.java:413) at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.access$300(UiDriverFactory.java:282) at com.qmetry.qaf.automation.ui.UiDriverFactory.getDriver(UiDriverFactory.java:221) at com.qmetry.qaf.automation.ui.UiDriverFactory.get(UiDriverFactory.java:89) at com.qmetry.qaf.automation.core.QAFTestBase$DriverInitExpectedCondition.apply(QAFTestBase.java:567) at com.qmetry.qaf.automation.core.QAFTestBase$DriverInitExpectedCondition.apply(QAFTestBase.java:1) at com.qmetry.qaf.automation.ui.util.DynamicWait.until(DynamicWait.java:147) at com.qmetry.qaf.automation.core.QAFTestBase.init(QAFTestBase.java:477) at com.qmetry.qaf.automation.core.QAFTestBase.getUiDriver(QAFTestBase.java:252) at com.qmetry.qaf.automation.ui.WebDriverTestBase.getDriver(WebDriverTestBase.java:44) at com.qmetry.qaf.automation.ui.WebDriverTestBase.getDriver(WebDriverTestBase.java:1) at com.qmetry.qaf.automation.ui.AbstractTestPage.(AbstractTestPage.java:81) at com.qmetry.qaf.automation.ui.AbstractTestPage.(AbstractTestPage.java:88) at com.qmetry.qaf.automation.ui.WebDriverBaseTestPage.(WebDriverBaseTestPage.java:65) at com.qmetry.qaf.automation.ui.WebDriverBaseTestPage.(WebDriverBaseTestPage.java:61) at com.poc.pages.BasePage.(BasePage.java:9) at com.poc.steps.PlynkStepDefs.(DemoStepDefs.java:28) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at com.qmetry.qaf.automation.step.DefaultObjectFactory.createInstance(DefaultObjectFactory.java:83) at com.qmetry.qaf.automation.step.DefaultObjectFactory.getObject(DefaultObjectFactory.java:60) at com.qmetry.qaf.automation.step.ObjectFactory$Provider.getObject(ObjectFactory.java:48) at com.qmetry.qaf.automation.step.JavaStep.getStepProvider(JavaStep.java:173) at com.qmetry.qaf.automation.step.JavaStep.doExecute(JavaStep.java:137) 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.Scenario.scenario(Scenario.java:237) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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) at org.testng.TestRunner.privateRun(TestRunner.java:756) at org.testng.TestRunner.run(TestRunner.java:610) at org.testng.SuiteRunner.runTest(SuiteRunner.java:387) at org.testng.SuiteRunner.access$000(SuiteRunner.java:39) at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:421) at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: com/qmetry/qaf/automation/ui/webdriver/QAFExtendedWebElement$JsonConvertor at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.standardConnect(UiDriverFactory.java:438) ... 52 more Caused by: java.lang.ClassNotFoundException: com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement$JsonConvertor at java.net.URLClassLoader.findClass(URLClassLoader.java:382) 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) ... 53 more Unable to create driver instance in 1st attempt with retry timeout of 0 seconds. You can check/set value of 'driver.init.retry.timeout' appropriately to set retry timeout on driver initialization failure.com/thoughtworks/selenium/CommandProcessor com.qmetry.qaf.automation.core.AutomationError: Unable to Create Driver Instance for appium: java.lang.reflect.InvocationTargetException Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'AS-HQ5V9V3-L', ip: '192.168.1.70', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202' Driver info: driver.version: unknown at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.standardConnect(UiDriverFactory.java:442) at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.getDriver(UiDriverFactory.java:413) at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.access$300(UiDriverFactory.java:282) at com.qmetry.qaf.automation.ui.UiDriverFactory.getDriver(UiDriverFactory.java:221) at com.qmetry.qaf.automation.ui.UiDriverFactory.get(UiDriverFactory.java:89) at com.qmetry.qaf.automation.core.QAFTestBase$DriverInitExpectedCondition.apply(QAFTestBase.java:567) at com.qmetry.qaf.automation.core.QAFTestBase$DriverInitExpectedCondition.apply(QAFTestBase.java:1) at com.qmetry.qaf.automation.ui.util.DynamicWait.until(DynamicWait.java:147) at com.qmetry.qaf.automation.core.QAFTestBase.init(QAFTestBase.java:477) at com.qmetry.qaf.automation.core.QAFTestBase.getUiDriver(QAFTestBase.java:252) at com.qmetry.qaf.automation.ui.WebDriverTestBase.getDriver(WebDriverTestBase.java:44) at com.qmetry.qaf.automation.ui.WebDriverTestBase.getDriver(WebDriverTestBase.java:1) at com.qmetry.qaf.automation.ui.AbstractTestPage.(AbstractTestPage.java:81) at com.qmetry.qaf.automation.ui.AbstractTestPage.(AbstractTestPage.java:88) at com.qmetry.qaf.automation.ui.WebDriverBaseTestPage.(WebDriverBaseTestPage.java:65) at com.qmetry.qaf.automation.ui.WebDriverBaseTestPage.(WebDriverBaseTestPage.java:61) at com.poc.pages.BasePage.(BasePage.java:9) at com.poc.steps.PlynkStepDefs.(DemoStepDefs.java:28) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.qmetry.qaf.automation.step.DefaultObjectFactory.createInstance(DefaultObjectFactory.java:93) at com.qmetry.qaf.automation.step.DefaultObjectFactory.getObject(DefaultObjectFactory.java:60) at com.qmetry.qaf.automation.step.ObjectFactory$Provider.getObject(ObjectFactory.java:48) at com.qmetry.qaf.automation.step.JavaStep.getStepProvider(JavaStep.java:173) at com.qmetry.qaf.automation.step.JavaStep.doExecute(JavaStep.java:137) 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.Scenario.scenario(Scenario.java:237) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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) at org.testng.TestRunner.privateRun(TestRunner.java:756) at org.testng.TestRunner.run(TestRunner.java:610) at org.testng.SuiteRunner.runTest(SuiteRunner.java:387) at org.testng.SuiteRunner.access$000(SuiteRunner.java:39) at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:421) at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'AS-HQ5V9V3-L', ip: '192.168.1.70', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202' Driver info: driver.version: unknown at com.qmetry.qaf.automation.ui.UiDriverFactory.getDriverObj(UiDriverFactory.java:263) at com.qmetry.qaf.automation.ui.UiDriverFactory.access$800(UiDriverFactory.java:73) at com.qmetry.qaf.automation.ui.UiDriverFactory$Browsers.standardConnect(UiDriverFactory.java:437) ... 51 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.qmetry.qaf.automation.ui.UiDriverFactory.getDriverObj(UiDriverFactory.java:261) ... 53 more Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: com.ssts.pcloudy.exception.ConnectError : Maximum allowed parallel automation session limit reached (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 2.07 seconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'AS-HQ5V9V3-L', ip: '192.168.1.70', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202' Driver info: driver.version: AndroidDriver Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'AS-HQ5V9V3-L', ip: '192.168.1.70', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202' Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:98) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:94) ... 58 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186) ... 71 more Caused by: org.openqa.selenium.SessionNotCreatedException: com.ssts.pcloudy.exception.ConnectError : Maximum allowed parallel automation session limit reached (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 2.07 seconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'AS-HQ5V9V3-L', ip: '192.168.1.70', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_202' Driver info: driver.version: AndroidDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54) at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128) ... 76 more Unable to create driver instance in 1st attempt with retry timeout of 0 seconds. You can check/set value of 'driver.init.retry.timeout' appropriately to set retry timeout on driver initialization failure.com/thoughtworks/selenium/CommandProcessor

Test ignored. Preparing For Shut Down... Preparing For Shut Down... Result updator: Completed 1 Remaining 0 result to be update. Disconnected from the target VM, address: '127.0.0.1:64440', transport: 'socket'

Process finished with exit code 0

Actual behavior

Is the issue reproducible on runner?

Test case sample

Please, share the test case (as small as possible) which shows the issue @cjayswal

cjayswal commented 7 months ago

This is not right place for help and support. You can utilize users group or stackoverflow with qaf tag for help or support. Help us to keep this clean having only bugs, new features or feature requests for better tracking.