findElementByAccessibilityid未在日食智能感知中显示

时间:2019-06-12 06:37:40

标签: java eclipse appium winappdriver

我正在尝试使用winappdriver为Windows应用程序进行POC。我已经安装并运行了winappdriver 1.1版。我想使用它们的automationId查找元素。根据winappdriver文档,具有AutiomationID的元素可以通过“ findElementByAccessibilityId”进行定位。我无法在Eclipse智能感知中看到此定位器策略。而是显示了“ findElementsByAccessibilityId”(注意元素)。我应该怎么做才能在智能感知中看到“ findElementByAccessibilityId”定位器。

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import io.appium.java_client.windows.WindowsDriver;

public class LoginTest {

    private static WindowsDriver<WebElement> driver = null;

    @BeforeClass
    public static void setup() throws MalformedURLException {

        DesiredCapabilities capabilities = new  DesiredCapabilities();
        capabilities.setCapability("app", "XXXXXXXXXXXXXXXXXXXXXX");
        capabilities.setCapability("platformName", "windows");
        capabilities.setCapability("deviceName", "windowsPC");
        capabilities.setCapability("appWorkingDir", "XXXXXXXXXXXXXXXXXXXXXXXXXX");
        driver = new WindowsDriver<WebElement>(new URL("http://127.0.0.1:4723"), capabilities);
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);     

    }

    @Test
    public void Testing()
    {
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        driver.findElement(By.className("TextBox")).sendKeys("XXXX");

        driver.findElementById("TxtPwd").sendKeys("XXXX");

        driver.findElementsByAccessibilityId("TxtPwd");

        driver.findElement(By.id("BtnLogin")).click();

        System.out.println("Hi");

    }

}

POM.xml

0 个答案:

没有答案