Appium: ожидание элементов на iOS больше не работает - PullRequest
0 голосов
/ 29 октября 2018

Я автоматизирую тесты для Android и iOS. В последнее время (возможно, после того, как я обновился до appium 1.9.1 и java-client 6.1.0) у меня возникли проблемы с тестами iOS.

Многие тесты не пройдены, потому что не удалось найти WebElements. Я использую WebDriverWait для поиска элементов, как в этом примере:

private WebElement getWebElement(By by, int timeOutInSeconds) {
    return (new WebDriverWait(appiumDriver, timeOutInSeconds)).until(ExpectedConditions.presenceOfElementLocated(by));
}

Тесты не ждут, чтобы найти элемент больше. Вместо этого выдается исключение немедленно.

Я использую XCUITest для iOS и uiautomator2 на Android. На андроиде тесты все еще в порядке.

Редактировать (2018-10-29 18:33):

Такое чувство, что фабрика страниц сообщает, что элемент есть, и тогда элемент 1014 * будет выполнен для элемента, который напрямую выдаст ошибку, потому что он не может найти элемент.

И еще одно наблюдение:

В некоторых случаях продолжительность ожидания работает корректно на iOS, но я пока не смог найти образец.

Редактировать (2018-12-14 15:56):

Решение пока не найдено. Примечание: мои тесты делают скриншоты при неудаче. Я могу видеть на многих скриншотах элементы, которые вызвали сбой. В журналах говорится, что их не удалось найти, но я отчетливо вижу их на экране. Не имеет смысла. Надеемся на идеи!

Редактировать (2019-01-11 15:05):

В журналах выглядит, что элемент найден (ответ 200), но когда я хочу выполнить щелчок, он говорит, что он «не виден на экране и, следовательно, не взаимодействует».

...
[HTTP] --> POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element
[HTTP] {"using":"id","value":"myapp"}
[debug] [W3C] Calling AppiumDriver.findElement() with args: ["id","buttonNext","59e9ace4-55a5-4b07-ad0e-af874dc42a6d"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC/element] with body: {"using":"id","value":"buttonNext"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"24010000-0000-0000-0308-000000000000"},"sessionId":"CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC","status":0}
[debug] [W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"24010000-0000-0000-0308-000000000000"}
[HTTP] <-- POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element 200 180 ms - 88
[HTTP] 
[HTTP] --> POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click
[HTTP] {"id":"24010000-0000-0000-0308-000000000000"}
[W3C] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command 'proxyReqRes'
[debug] [JSONWP Proxy] Matched '/wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click' to command name 'click'
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click] to [POST http://localhost:8100/session/CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC/element/24010000-0000-0000-0308-000000000000/click] with body: {"id":"24010000-0000-0000-0308-000000000000"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"The element '\"buttonNext\" Button' is not visible on the screen and thus is not interactable\" UserInfo={NSLocalizedDescription=The element '\"buttonNext\" Button' is not visible on the screen and thus is not interactable}","sessionId":"CE691ADA-FC54-48AE-9AA0-1DA6212DB2CC","status":13}
[debug] [W3C] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: The request to /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click has failed
[debug] [W3C]     at JWProxy.proxy$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:182:13)
[debug] [W3C]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[debug] [W3C]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [MJSONWP] Matched JSONWP error code 13 to UnknownError
[HTTP] <-- POST /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/element/24010000-0000-0000-0308-000000000000/click 500 4875 ms - 1779
[HTTP] 
[HTTP] --> GET /wd/hub/session/59e9ace4-55a5-4b07-ad0e-af874dc42a6d/screenshot
[HTTP] {}
...
...