2016-10-20 2 views
0

次のコントロールのcssSelectorステートメントに問題があります。ポップオーバーテキストの識別に問題がある

<div class="popover-content"> 
<i class="icon-time"></i> 
<h3>24 Hours Risk Free!</h3> 
<p> 
    Book now and 
    <strong>cancel for free up to 24 hours</strong> 
</p> 
</div> 

この警告が存在することを確認するテストを書く必要があります。誰でもアイデアはありますか?

答えて

0

あなただけのクラスを使用してdivタグを見つけると、そのテキストを取得jQueryの

<a id="btnT" class="btn btn-xs btn-warning">Test</a> 

var x = false; 
    $(document).ready(function(){ 
      $('#btnT').popover({ 
      placement: 'bottom', 
      title: '${trainingDetail.title}', 
      content: '${trainingDetail.description}', 
      trigger: 'click', 
      html : true, 
      container: 'body' 
     }).hover(function() { 
       if (x) { 
        $(this).popover('hide'); 
        x = false; 
       } 
       else { 
       $(this).popover('show'); 
       x = true; 
       } 
      }); 
    }); 
+0

私はこのようなものを使用できませんでしたか? – Sulteric

+0

css = "div [class = 'popover-content']> div" – Sulteric

0

を使用することができます。 h3タグとpタグのすべてのテキストが表示されます。

driver.findElement(By.className("popover-content")).getText(); 

あなたは既にそれを上に置くことができると仮定します。etc. ActionsクラスとmoveToElementメソッドを使用します。

関連する問題