Я пытаюсь написать тест, используя Java / TestNG, запущенный на ферме устройств AWS;однако я не могу найти свое поле "account".
HomePage.java
public class HomePage {
@iOSFindBy(accessibility = "account")
public IOSElement accountField;
public HomePage(AppiumDriver driver) {
PageFactory.initElements(new AppiumFieldDecorator(driver, 5, TimeUnit.SECONDS), this);
}
}
Тестовый класс
@BeforeMethod
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = DesiredCapabilities.iphone();
driver = new IOSDriver<IOSElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void selectAccount() throws InterruptedException {
driver.manage().timeouts().implicitlyWait(35, TimeUnit.SECONDS);
HomePage page = new HomePage(driver);
new TouchAction(driver).tap(page.accountField).perform();
}
Запуск этого теста на ферме устройств выдает мне эту ошибку:
selectAccount failed: Can't locate an element by this strategy: Locator map: - native content: "By.AccessibilityId: account" - html content: "by id or name "account""
Соответствующие локальные журналы
...
[MJSONWP] Responding to client with driver.createSession() result: {"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"app":"/Users/..../Downloads/.....ipa","platformVersion":"11.3.1","automationName":"XCUITest","platformName":"iOS","udid":".....","deviceName":"iPhone SE"}
[JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/1470E279-8FD3-4CFE-944C-051CDF7F2A25/elements] with body: {"using":"accessibility id","value":"account"}
[JSONWP Proxy] Got response with status 200: {"value":[{"ELEMENT":"0C000000-0000-0000-1701-000000000000"}],"sessionId":"1470E279-8FD3-4CFE-944C-051CDF7F2A25","status":0}
[MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"0C000000-0000-0000-1701-000000000000"}]
...
Соответствующие журналы фермы устройств
...
New IosDriver session created successfully, session 1dd93c26-55f6-4fdd-9963-2e3dbbc17386 added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1528814874003 (14:47:54 GMT+0000 (UTC))
[MJSONWP] Responding to client with driver.createSession() result: {\"webStorageEnabled\":false,\"locationContextEnabled\":false,\"browserName\":\"iPhone\",\"platform\":\"MAC\",\"javascriptEnabled\":true,\"databaseEnabled\":false,\"takesScreenshot\":true,\"networkConnectionEnabled\":false,\"platformName\":\"iOS\",\"version\":\"\",\"platformVersion\":\"9.3\",\"deviceName\":\".....\",\"app\":\"/tmp/scratch4iVs4j.scratch/share-CjbXpc.scratch/app-3ZPujz.ipa\",\"udid\":\".....\",\"desired\":{\"browserName\":\"iPhone\",\"platformName\":\"iOS\",\"version\":\"\",\"platform\":\"MAC\",\"platformVersion\":\"9.3\",\"deviceName\":\".....\",\"app\":\"/tmp/scratch4iVs4j.scratch/share-CjbXpc.scratch/app-3ZPujz.ipa\",\"udid\":\".....\"}}
...
[MJSONWP] Responding to client with driver.getCurrentContext() result: \"NATIVE_APP\"
<-- GET /wd/hub/session/1dd93c26-55f6-4fdd-9963-2e3dbbc17386/context 200 18 ms - 84
--> POST /wd/hub/session/1dd93c26-55f6-4fdd-9963-2e3dbbc17386/elements {\"using\":\"accessibility id\",\"value\":\"account\"}
[MJSONWP] Calling AppiumDriver.findElements() with args: [\"accessibility id\",\"account\",\"1dd93c26-55f6-4fdd-9963-2e3dbbc17386\"]
[iOS] Executing iOS command 'findElements'
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, -ios uiautomation, accessibility id
[BaseDriver] Waiting up to 0 ms for condition
[UIAuto] Sending command to instruments: au.getElementsByAccessibilityId('account')
[UIAuto] Socket data received (25 bytes)
[UIAuto] Got result from instruments: {\"status\":0,\"value\":[]}
[MJSONWP] Responding to client with driver.findElements() result: []
<-- POST /wd/hub/session/1dd93c26-55f6-4fdd-9963-2e3dbbc17386/elements 200 834 ms - 74
...
Я сделалснимок экрана после 35-секундного неявного ожидания и подтверждение того, что мое поле находится на странице.
Я также безуспешно пытался выбрать поле учетной записи:
@Test
public void selectAccount() throws InterruptedException {
driver.manage().timeouts().implicitlyWait(35, TimeUnit.SECONDS);
WebElement el = driver.findElement(By.name("account"));
new TouchAction(driver).tap(el).perform();
}
У кого-нибудь естьИдея о том, как найти мое поле "аккаунт"?Это работает локально, используя appium.