2017-08-09 60 views
0

我正在面對通過OPA5腳本選擇單選按鈕的問題。 我必須通過OP5腳本在View頁面的兩個單選按鈕中選擇一個。SAPUI5 opa5我們如何通過OPA5腳本選擇單選按鈕

在View.xml中單選按鈕從後端動態顯示。 單選按鈕從後端來是::是的,

號能否請你幫我解決這個問題..

這是我的代碼.. view.xml用:

<RadioButtonGroup id="assetRadioButton" columns="2" selectedIndex="-1" buttons="{path:'to_InfoOptoin' ,templateShareable : 'false'}" select="onAssetAnsChange"> 
    <buttons> 
     <RadioButton text="{InfoOptionDesc}"> 
      <!--<core:customData value="{InfoOptionId}"></core:customData>--> 
     </RadioButton> 
    </buttons> 
</RadioButtonGroup> 

OPA5腳本..

When.waitFor({ 
    id: "assetRadioButton", 
    viewName: sViewName, 
    controlType: "sap.m.RadioButtonGroup", //optional 
    success: function(oSelect) { 
     this.waitFor({ 
      controlType: "sap.m.RadioButton", 
      matchers: [ 
       new sap.ui.test.matchers.Ancestor(oSelect), 
       new Properties({ 
        text: "Yes", 
        enabled: true 
       }) 
      ], 
      success: function(aButtons) { 
       aButtons[0].$().trigger("tap"); 
       Opa5.assert.ok(true, "Yes", "Yes"); 
      }, 
      errorMessage: "Cannot select Yes from assetRadioButton" 
     }); 
    }, 
    errorMessage: "There was no Radio Button selelcted" 
}); 

正如我從以下鏈接知道個https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.test.actions.Press.html#constructor

單選按鈕不會接受的新聞發佈會,所以我不會用按()

能否請你幫我,使工作

預先感謝您。

回答

0

我做了一些解決辦法,現在解決這個問題..

return this.waitFor({ 
          viewName: sViewName, 
          controlType: "sap.m.RadioButtonGroup", 
          success : function (aNodes) { 
           var oFirstItem = aNodes[0]; 
           oFirstItem.$().trigger("tap"); 
           aNodes[1].setSelectedIndex(1); 

           oFirstItem.fireSelect(); 
           Opa5.assert.ok(true, "Yes is selected"); 
           return this; 
          }, 
          errorMessage: "Radio Button was not Selected" 
         }); 
相關問題