2015-11-05 23 views

回答

0

經過一番調試,我發現僞搜索事件saptouchstartsaptouchend的組合在搜索字段中的放大鏡圖標中起作用。

return this.waitFor({ 
    id: "mySearchField", 
    viewName: sViewName, 
    success: function (control) { 
     var event, searchIcon; 

     event = jQuery.Event("saptouchend"); 
     event.originalEvent = event; // would otherwise cause NPE at some point in SAP code 
     searchIcon = control.$().find("div[id*=mySearchField-search]"); 
     searchIcon.trigger("saptouchstart").trigger(event); 
    }, 
    errorMessage: "Search field not found" 
}); 
0

這也可以用下面的一行代碼(source)完成:

$(theSearchField).trigger("onSearch"); 

但也許這是唯一可能與一個較新版本的UI5比你用的那個。

0

另一種解決方案的方法是使用一個EnterText action,它不僅輸入搜索項(在下面的例子中「foobar的」),但也可觸發搜索算賬:

this.waitFor({ 
    id: "mySearchField", 
    actions: [ new sap.ui.test.actions.EnterText({ text: "foobar" }) ] 
}); 
相關問題