2016-08-31 4 views
0

ボタンをクリックすると追加された行のXpathを見つけようとしています。最初の行と最初の列では、datepickerをクリックして日付を選択する必要があります。どのようにしてこの日付ピッカーの要素のXpathを見つけることができますか?以下は、私は、コードの下にしようとした私のコードどのようにボタンをクリックするとXpathが見つかりましたか?JQGridに行が追加されました

 `<table id="list" class="ui-jqgrid-btable" cellspacing="0" 
     cellpadding="0" border="0" style="border: 0px none ! important; 
     width: 2205px;" tabindex="0" role="grid" aria-multiselectable="false" aria-labelledby="gbox_list"> 
     <tbody> 
     <tr class="jqgfirstrow" style="height:auto" role="row"> 
     <td style="height:0px;width:100px;" role="gridcell"></td> 
     <td style="height:0px;width:70px;" role="gridcell"></td> 
     <td style="height:0px;width:120px;" role="gridcell"></td> 
     <td style="height:0px;width:200px;" role="gridcell"></td> 
     <td style="height:0px;width:120px;" role="gridcell"></td> 
     <td style="height:0px;width:140px;" role="gridcell"></td> 
     <td style="height:0px;width:65px;" role="gridcell"></td> 
     <td style="height:0px;width:65px;" role="gridcell"></td> 
     <td style="height:0px;width:70px;" role="gridcell"></td> 
     <td style="height:0px;width:160px;" role="gridcell"></td> 
     <td style="height:0px;width:70px;" role="gridcell"></td> 
     <td style="height:0px;width:160px;" role="gridcell"></td> 
     <td style="height:0px;width:170px;" role="gridcell"></td> 
     <td style="height:0px;width:100px;" role="gridcell"></td> 
     <td style="height:0px;width:100px;" role="gridcell"></td> 
     <td style="height:0px;width:130px;" role="gridcell"></td> 
     <td style="height:0px;width:70px;" role="gridcell"></td> 
     <td style="height:0px;width:130px;" role="gridcell"></td> 
     <td style="height:0px;width:70px;" role="gridcell"></td> 
     <td style="height:0px;width:150px;display:none;" role="gridcell"></td> 
     </tr> 
     <tr id="1" class="ui-widget-content jqgrow ui-row-ltr ui-state- 
     highlight disableRow" tabindex="0" role="row" aria-selected="true" 
     editable="1"> 
     <td rowspan="1" aria-describedby="list_effectiveDate" style="" role="gridcell"> 
     <input id="1_effectiveDate" class="editable hasDatepicker border- 
     red" type="text" name="effectiveDate" style="width: 98%;" role="textbox" readonly="readonly"></td> 

`

です:

​​
+0

あなたは何を意味するのか不明です。特定のコントロールを見つけてクリックをエミュレートする必要があるボット/リーダーのようなものを書いていますか? もう少し詳しい説明をしてください。 – Culme

+0

はい。それを選択してクリックしなければなりません。私は[id = "1_effectiveDate"]のXpathを見つけようとしています。 JQgridのデフォルトは、日付ピッカーです。入力フィールドです。私は日付ピッカーで日付を選択する必要があります。私はxpathの下で試した:driver.findElement(By.xpath( ".//* [id = '1']/td [1]"))。toString(); driver.findElement(By.id( "1_effectiveDate"))。click(); driver.findElement(By.xpath( ".//*[id = 'ui-datepicker-div']/table/tbody/tr [5]/td [2]/a"))。 – kurri

+0

JQueryはオプションになりますか?その後、XPathをスキップして、JQueryを使用してDOM要素を操作できます。 – Culme

答えて

0

jQueryのはオプションでしょうか?その後、XPathをスキップして、JQueryを使用してDOM要素を操作できます。

また、本当にカレンダーをクリックする必要があるかどうかを確認しますか?あなたはあなたの選択の価値をそれだけで提供できませんでしたか?見た目からは、テキストフィールドをバッキングとして使用します。どのフォーマットに日付が格納されているかだけを知っていれば、そのクリックをエミュレートすることなくそのテキストボックスに値を直接追加することができます。

+0

デザインごとにカレンダーでのみ日付を選択できます。入力テキストボックスはありません。彼らはJQGridテーブルのデフォルトの日付ピッカーを使用しました。 – kurri

+0

JQueryはオプションですか? – Culme

関連する問題