[英]Frank Test : UIPickerView not Updating Value in Cell
所以,我有以下日期選擇器視圖:
這與Date of Birth
單元格相關:
現在,在我的弗蘭克測試中,我想移動玻璃杯,然后在文本框中反映最終值。 我這樣做是為了:
dateValue = "04.11.2002"
dateParts = dateVale.split('.')
for i in 2.downto(0) do
frankly_map( "view:'UIPickerView' index:0", 'selectRow:inComponent:animated:', dateParts[i].to_i - 1, i, false )
end
因此,我們遍歷玻璃杯並將其更改為適當的值。 但是,不倒翁的變化不會反映在UITextBox中。 所以我決定通過點擊UIPickerView中的任何值來更新它:
touch("view marked:'15'")
但是,這改變了每個不倒翁! 誰能告訴我為什么會這樣,以及如何確定日期?
這是Java
我從選擇器視圖中選擇一個值的方法(使用所選選擇器值的UITextField
也已更新,因為您必須生成滾動事件):
/**
* Select row with @rowValue value for @selector UI picker view.
*
* @param selector
* @param rowValue
* @throws Exception
*/
public static void selectRowFromPicker(String selector, String rowValue) throws Exception {
int component = 0;
JSONArray rowsCountArray = Frank.frankly_map(selector, "numberOfRowsInComponent:", component);
if (rowsCountArray.length() == 0) {
throw new Exception("No rows for picker view component " + component + " were found.");
}
int rowsCount = rowsCountArray.getInt(0);
String tableViewSelector = selector + " descendant tableView";
boolean found = false;
String initialText = "";
for (int i = 0; i < rowsCount; i++) {
JSONArray array = Frank.frankly_map(selector, "selectRow:inComponent:animated:", i, component, true);
if (array.length() == 0) {
throw new Exception("Could not select row from picker view with row value: '" + rowValue + "' selector: '" + selector + "'");
}
String labelSelector = tableViewSelector + " descendant label index:0";
WaitHelper.waitFor(WaitHelper.not(WaitHelper.viewTextToHaveValue(labelSelector, initialText)), GlobalVariables.MEDIUM);
JSONArray currentTableViewRowValue = Frank.frankly_map(labelSelector, "text");
if (currentTableViewRowValue.length() == 0) {
throw new Exception("Could not get the text for current row for picker view selector: " + selector);
}
if (currentTableViewRowValue.getString(0).equals(rowValue)) {
found = true;
break;
}
initialText = currentTableViewRowValue.getString(0);
}
//Need to generate a scroll event to bind data in the controls which use the picker selected value
if (!Frank.scrollDownRows(tableViewSelector, 0) || !found) {
throw new Exception("Could not scroll down in the picker view selector: " + selector);
}
}
Frank.scrollDownRows
: Frank.frankly_map(selector, "scrollDownRows:", noOfRows);
我希望這有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.