Appium_Error: возвращаемое значение не может быть преобразовано в WebElement с Xcode 10.0 - PullRequest
0 голосов
/ 01 июля 2019

Получение ошибки 'Возвращаемое значение не может быть преобразовано в WebElement'

Версия Xcode: 10.0 Версия сервера Appium: 1.9.1 / 1.13.0 Версия клиента Appium: 6.1.0 / 7.0.0 Версия Selenium:3.9.1 / 3.14.0 IOS Simulator Версия: 11.4

Пробовал использовать разные версии, как показано ниже: Версия Appium Server: от 1.7.2 до 1.14.2 бета-версия Appium Client: 5.0.4 до 7.0.0Также пытались включить неявное ожидание и явное ожидание.Не повезло: (

Клиентский журнал Appium, как показано ниже:

[RemoteTestNG] detected TestNG version 6.11.0
Jul 01, 2019 10:34:30 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
FAILED CONFIGURATION: @BeforeSuite setupDriver
org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=2B000000-0000-0000-777A-000000000000, ELEMENT=2B000000-0000-0000-777A-000000000000}
Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z'
System info: host: 'Bindacharyas-MacBook-Pro.local', ip: 'fe80:0:0:0:c4b:5bdc:c1c1:72f2%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_211'
Driver info: driver.version: IOSDriver
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:421)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.findElement(IOSDriver.java:1)
at io.appium.java_client.FindsByAccessibilityId.findElementByAccessibilityId(FindsByAccessibilityId.java:31)
at com.noon.ui.tests.sanitySuites.TestIOSAnother.prepareIOSForAppium(TestIOSAnother.java:103)
at com.noon.ui.tests.sanitySuites.TestIOSAnother.setupDriver(TestIOSAnother.java:58)
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:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:326)
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:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.openqa.selenium.WebElement
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:419)
... 25 more

Несколько строк кода, как показано ниже:

capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6s Plus");
        capabilities.setCapability("wdaStartupRetries", 5);
        capabilities.setCapability("autoAcceptAlerts", true);

        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability("newCommandTimeout", 250);

        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.4");

        capabilities.setCapability(MobileCapabilityType.APP, "/Users/bindacharyaj/Documents/Simulator/k12App-ios.app");
        capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        capabilities.setCapability(MobileCapabilityType.UDID, "777EA4A8-0C82-485D-8347-8EF3527B135A");

        capabilities.setCapability("bundleId", "com.noonEdu.k12App");
        capabilities.setCapability("updatedWDABundleId", "com.facebook.wda.lib");
        capabilities.setCapability("wdaLocalPort", 8101);

        driver = new IOSDriver<MobileElement>(url, capabilities);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println(driver.getContext());
        driver.context("NATIVE_APP");

    }

    // 6
    @Test(enabled = true)
    public void myFirstTest() throws InterruptedException {

        Thread.sleep(000);

        System.out.println("Test Started");


        ((WebElement) driver.findElement(By.xpath("//XCUIElementTypeStaticText[@name='السعودية']"))).click();
        System.out.println("Click -1");
        Thread.sleep(2000);

Запуск Appiumприложение, но не может нажать на любой из родных элементов. Любая помощь будет признательна !!

Заранее спасибо ... !!!!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...