estoy intentando de automatizar una app la cual nesecito que me lea un label y su texto, y que este sea mostrado por consola la app està de la siguiente forma.
DesiredCapabilities dc = new DesiredCapabilities();
//@BeforeMethod
protected void setUp(String deviceName, String versionAndroid ) throws MalformedURLException {
dc.setCapability("deviceName", deviceName);
dc.setCapability("platformVersion", versionAndroid);
dc.setCapability("platformName","Android");
dc.setCapability("automationName","Appium");
dc.setCapability("appPackage", "com.ripley.banco.peru");
dc.setCapability("appActivity", "md50120b660b57d6504f7403c716c787885.MainActivity");
//driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), dc);
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), dc);
driver.setLogLevel(Level.INFO);
}
este es el mètodo:
protected void prueba(String equipo,String versionSO) throws MalformedURLException {
setUp(equipo, versionSO);
waitSleep(2);
//if(assertEquals(driver.findElement(Constantes.txtTipoDeDocumento)) == "Tipo de documento"){
AndroidElement ele = (AndroidElement) driver.findElement(By.xpath(Constantes.txtTipoDeDocumento));
//(RemoteElement)driver.findElement(By.xpath(Constantes.txtTipoDeDocumento));
System.out.println(ele.getText());
}
al final me lanza este error.
java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebElement cannot be cast to io.appium.java_client.android.AndroidElement at pe.abs.absRipley.prueba(absRipley.java:827) at pe.casos.TestEscenario1.caso46(TestEscenario1.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeMethod(Invoker.java:661) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:744) at org.testng.TestRunner.run(TestRunner.java:602) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144) at org.testng.TestNG.run(TestNG.java:1115) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
=============================================== Default test Tests run: 1, Failures: 1, Skips: 0