2016-05-20 11 views
0

これまで数時間この問題に取り組んできましたが、私はまだそれに固執しています。 HTMLコードのこの部分で分度器 - CSSでネストされた要素を取得できません

:分度器E2E試験について

<div class="container ng-scope"> 
    <div class="fc-toolbar"></div> 
    <div class="fc-view-container" style=""> 
    <div class="fc-view fc-agendaWeek-view fc-agenda-view"> 
     <table> 
      <thead class="fc-head"></thead> 
      <tbody class="fc-body"> 
       <tr> 
       <td class="fc-widget-content"> 
        <div class="fc-day-grid"></div> 
        <hr class="fc-divider fc-widget-header"> 
        <div class="fc-time-grid-container fc-scroller" style="height: 329px;"> 
         <div class="fc-time-grid"> 
          <div class="fc-bg"></div> 
          <div class="fc-slats"> 
          <table> 
           <tbody> 
            <tr> 
             <td class="fc-axis fc-time fc-widget-content" style="width: 44px;"><span>00</span></td> 
             <td class="fc-widget-content"></td> 
            </tr> 
            <tr class="fc-minor"> 
             <td class="fc-axis fc-time fc-widget-content" style="width: 44px;"></td> 
             <td class="fc-widget-content"></td> 
            </tr> 
            <tr> 
             <td class="fc-axis fc-time fc-widget-content" style="width: 44px;"><span>01</span></td> 
             <td class="fc-widget-content"></td> 
            </tr> 
            <tr class="fc-minor"> 
             <td class="fc-axis fc-time fc-widget-content" style="width: 44px;"></td> 
             <td class="fc-widget-content"></td> 
            </tr> 
            <tr> 
             <td class="fc-axis fc-time fc-widget-content" style="width: 44px;"><span>02</span></td> 
             <td class="fc-widget-content"></td> 
            </tr> 
            <tr class="fc-minor"> 
             <td class="fc-axis fc-time fc-widget-content" style="width: 44px;"></td> 
             <td class="fc-widget-content"></td> 
            </tr> 
           </tbody> 
          </table> 
          </div> 
         </div> 
        </div> 
       </td> 
       </tr> 
      </tbody> 
     </table> 
    </div> 
    </div> 

、Iは、テーブル内の第2 trをキャッチしgetLocation()を使用してその座標を取得しなければなりません。

これは私がTRをキャッチすることになってどのようである:

var secondRow = element(by.css('.fc-body tr .fc-time-grid-container.fc-scroller .fc-slats table tbody tr:nth-child(2)')); 

そして、どのように私はその座標を取得することがあります。

secondRow.getLocation() 

私は私が得た上記のコードを実行しようとするたび:

NoSuchElementError: No element found using locator: By.cssSelector(".fc-body tr .fc-time-grid-container.fc-scroller .fc-slats table tbody") 

&のペースト.fc-body tr .fc-time-grid-container.fc-scroller .fc-slats table tbodyをブラウザのコンソールにコピーするとJQuery、それは2番目のtrを正しく返します。

分度器で作業していない理由がわかりません。

+0

iframeにテーブルがありますか?あなたはまだいくつかの睡眠を追加しようとしますか? – Buaban

+0

テーブルはiframeではありません。上記のコードはfullcalendarから取得されています。追加すると問題は解決します。 – grimi

+0

あなたはcss-selectorを使用している特定の理由はありますか? – RemcoW

答えて

1

あまりにも簡単にキャッチすることはできませんでした。私はbeforeEachが見つかるたびにメインページをリロードし、多くの要素(そのようなもの)が存在しなかったことがわかりました。

私は注意を払う必要があった...

beforeEach(function() { 
    browser.get('http://localhost:9000/#/');//<--- ...to this line! 
}); 

は今、私はその要素を取得することができます。

関連する問題