つれづれなるままに。

webテストの自動化について備忘録のつもりで書いています

SeleniumIDE の UI-Element その4 UI-Argument

少し調査が進みました。

map.addElement('searchPages', {
   name: 'result'
   , description: 'link to a result page'
   , args: [{
     name: 'index'
   , description: 'the index of the search result'
   , defaultValues: range(1, 21)
  }
, {
     name: 'type'
   , description: 'the type of result page'
   , defaultValues: [ 'summary', 'detail' ]
  }
]
, getLocator: function(args) {
    var index = args['index'];
    var type = args['type'];
    return "//div[@class='result'][" + index + "]" + "/descendant::a[@class='" + type + "']";
  }
});

これを使う場合

<td>click</td>
<td>UI=searchPages::result(index=1,type=summary)</td>
<td></td>

と、パラメータを指定することにより、ロケーションを指定することができます。

例のように検索結果に付いたテキストリンクを動的に指定することができる訳です

まだ、不明なのが、 defaultValues に関数を定義できるようなのですが
これをどう使えばいいのかは、まだ不明です・・・

なかなかたどり着けないな〜