1

Selenium IDE を使用していて、フィールド内のオートコンプリート項目をクリックしようとしています。要素をクリックする方法が見つかりません。アイテムをクリックすると、次のフィールドに入力されます。私はこれを2日間いじっていますが、理解できません。フィールド内でマウス カーソルを取得できた場合は、押してから Enter キーを押すと、おそらく機能します。私は試した:

<td>clickAt</td>
<td>id=txtCategory</td>
<td></td>

<td>keyPress</td>
<td>css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all</td>
<td>\40</td>

<td>keyPress</td>
<td>css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all</td>
<td>\13</td>

しかし、うまくいきませんでした。sendkeys、keydown、および keypress でフォーカスおよび/またはぼかしを使用しようとしましたが、それを機能させることができなかったようです。オートコンプリートの単語の上にマウスを置くと、ホバー状態になります。セレンでその状態にアクセスする方法が見つかりませんでしたし、必要かどうかもわかりません。どんな助けでも大歓迎です。

これは、Selenium IDEで試していたいくつかのこととともに、firebugによって検査されている間にクリックしようとしているフィールドの写真へのリンクです。

私も試しました:

値の場合、「顧客小切手が返送されました」と入力する必要がありましたか? フィールド内のテキストを取得できますが、実際にオートコンプリートされたテキストをクリックしないと、次のフィールドに入力されません。これが私が試したものです:

<td>typeKeys</td>
<td>css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all</td>
<td>Customer check bounced</td>



<td>fireEvent</td>
<td>css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all</td>
<td>focus</td>



<td>fireEvent</td>
<td>css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all</td>
<td>blur</td>


<td>keyPress</td>
<td>css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all</td>
<td>\13</td>

ここに画像の説明を入力

ありがとう、ボブ

4

3 に答える 3

1

2日間の検索の後、問題の解決策を見つけることができました. アイテムを見つけて、html を使用してクリックできます。私が使用した手順は次のとおりです。

1. Click into the field to cause the autocomplete to fire

<td>clickAt</td>
<td>id=txtCategory</td>
<td></td>

2. Mouseover the field that contains the autocompleted word I need to click

<td>mouseOver</td>
<td>//html/body/ul/li/a/b</td>
<td></td>

3. Click the autocomplete item I need to click in order for the next field to function

<td>click</td>
<td>//html/body/ul/li/a/</td>
<td></td>
于 2013-05-24T14:08:19.370 に答える
1

私は Selenium IDE を使用しており、Google プレイス オートコンプリートから生成された要素を選択しようとしています。次のスクリプトは問題なく動作します。

<tr>
    <td>sendKeys</td>
    <td>id=address</td>
    <td>48 Westlawn Dr.</td>
</tr>
<tr>
    <td>keyDown</td>
    <td>id=address</td>
    <td>\40</td>
</tr>
<tr>
    <td>keyDown</td>
    <td>id=address</td>
    <td>\13</td>
</tr>
  1. sendKeysドロップダウンメニューを起動します
  2. keyDown選択の間をジャンプする
  3. 最後keyDownはエンターキーを送信することです

トリックは、同じ要素に対して実行されるすべての操作です。

参照: http://www.software-testing-tutorials-automation.com/2013/06/selenium-keydown-command-to-select.html

于 2017-04-24T23:57:00.810 に答える
0

オートコンプリート コマンドに Selenium で typekeys コマンドを使用しました。これは、指定された文字列内のすべての文字に対して keyDown、keyUp、keyPress を呼び出す便利なメソッドです。これは、明示的なキー イベントを必要とする動的 UI ウィジェット (オートコンプリート コンボ ボックスなど) に役立ちます。

typeKeys| css=.ui-corner-all+.ui-corner-all+.ui-corner-all+.ui-corner-all | value
于 2013-05-23T09:11:48.070 に答える