0

Selenium 2.0 を使用してアプリケーションの GUI をテストしています。

入力フィールドにデータを入力すると提案ボックスが表示され、提案ボックスをクリックして入力を検証する必要があります。

ここに画像:画像

私のhtmlコード(入力):

<table class="supplier" cellspacing="1" width="100%">
<tbody>
<tr>
<td><span id="supplier:supplierOps" class="ui-autocomplete">
<input id="supplier:supplierOps_input" name="supplier:supplierOps_input" type="text" class="ui-autocomplete-input ui-inputfield ui-widget ui-state-default ui-corner-all" autocomplete="off" value="" size="10" role="textbox" aria-disabled="false" aria-readonly="false" aria-multiline="false">
</span></td>
<td>...</td>
</tr>
</tbody>
</table>

私のhtmlコード(suggestBox):

<table class="ui-autocomplete-items ui-autocomplete-table ui-widget-content ui-widget ui-corner-all ui-helper-reset">
<tbody>
<tr class="ui-autocomplete-item ui-autocomplete-row ui-corner-all ui-state-highlight" data-item-value="1" data-item-label="OPS1">
<td>OPS1 - Supplier1</td>
</tr>
</tbody>
</table>

私のセレンコード:

// supplier ops, i find and type data into the input
WebElement eSupplier = driver.findElement(By.id("supplier:supplierOps_input"));
eSupplier.sendKeys("OPS1");
sleep(5); // wait the suggestbox

// i find the suggestbox
WebElement eSupplierSuggest = driver.findElement(By.xpath("//div[@id='supplier:supplierOps_panel']/table/tbody/tr"));
eSupplierSuggest.click();
sleep(5); // wait the refresh for the next field supplierAddress

私のxpathとすべてが問題ないようです。

したがって、質問は次のとおりです。どの要素(td、tr、table、...)をキャッチ/選択する必要があり、どのメソッド(driver.click()、sendKeys()、...)を検証に使用する必要がありますか提案ボックス?

編集 :

検証が承認されたとき、suggestbox にはフォーカスがありません。だから私はそれに焦点を合わせてsendKeys(Keys_ENTER)を試すために検索しています。WebElement にフォーカスを設定しますか?

EDIT2:

一部のニュース担当者、Arquillian Graphene で解決しようとしています。Ajax 対応の再利用可能なテストとテストの抽象化をテスターに​​作成させるフレームワークです。

リンク : グラフェンの紹介 - Graphene 2.0.0.Alpha3 リリース - JBoss Community Graphene2 - Jquery Selector

4

2 に答える 2

0

提案ボックスをクリックする代わりに、提案ボックスを見つけて、提案ボックスのテキストを抽出できます。入力したテキストが含まれていることを表明します。

于 2013-04-17T03:24:09.113 に答える