我正在從咖啡的Web咖啡webView的webkeys在Android 8.0模擬器失敗
@Test
public void typeTextInInput_clickButton_SubmitsForm() {
// Lazily launch the Activity with a custom start Intent per test.
mActivityRule.launchActivity(withWebFormIntent());
// Selects the WebView in your layout. If you have multiple WebView objects,
// you can also use a matcher to select a given WebView,
// onWebView(withId(R.id.web_view)).
onWebView()
// Find the input element by ID.
.withElement(findElement(Locator.ID, "text_input"))
// Clear previous input and enter new text into the input element.
.perform(clearElement())
.perform(DriverAtoms.webKeys(MACCHIATO))
// Find the "Submit" button and simulate a click using JavaScript.
.withElement(findElement(Locator.ID, "submitBtn"))
.perform(webClick())
// Find the response element by ID, and verify that it contains the
// entered text.
.withElement(findElement(Locator.ID, "response"))
.check(webMatches(getText(), containsString(MACCHIATO)));
}
它製作的7.1.1模擬器但不是在8.0 我得到了錯誤消息
一些測試代碼所致:了java.lang.RuntimeException:錯誤evaluationEvaluation:狀態:13值:{消息=無法設置的選定結束} hasMessage:真消息:不能設定的選定結束
如果我更改代碼
element.
.perform(clearElement())
.perform(DriverAtoms.webKeys(MACCHIATO)) => perform(webClick())
然後,它的工作原理。所以我猜想它可以找到元素只是不執行操作。 有什麼我需要改變我的代碼?
謝謝它適合我。一段時間以來,我一直在使用舊版的android espresso。 – Puff