2016-04-19 21 views
10

角度ng-if条件を持つ次のコードがページにあります。角度ng-if条件の実行後にセレンDOMが変更されない

<p ng-if="!old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have created a new account with &rsquo;{{ new_email }}&lsquo;, for you on<br> Plobal Apps to preview and test your app and mailed you the details. Please check your inbox. 
</p> 

<p ng-if="new_user && old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have created a new account with &rsquo;{{ new_email }}&lsquo;, for you on<br> Plobal Apps to preview and test your shopify app and mailed you the details. Please check your inbox. 
    <br /> 
    You have been logged out of the previous account with &rsquo;{{ old_email }}&lsquo;. 
</p> 

<p ng-if="existing_user && old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have logged you in with &rsquo;{{ new_email }}&lsquo;, on Plobal Apps to preview and test your shopify app. 
    <br /> 
    You have been logged out of the previous account with &rsquo;{{ old_email }}&lsquo;. 
</p> 

ng-if条件は、要件ごとに動的に実行され、タグを取得します。私はhtmlページですべてが機能していることを観察しました。私は、ページを検査した後にhtmlコードを見ました。

<!-- ngIf: !old_email --> 

<!-- ngIf: new_user && old_email --> 

<!-- ngIf: existing_user && old_email --><p class="ng-binding ng-scope" ng-if="existing_user &amp;&amp; old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have logged you in with ’[email protected]‘, on Plobal Apps to preview and test your shopify app. 
    <br> 
    You have been logged out of the previous account with ’[email protected]‘. 
</p><!-- end ngIf: existing_user && old_email --> 

私はセレンで親要素のinnerHTMLプロパティを印刷する場合は私の理解あたりに、セレンDOMは角度NG-かの条件を実行した後に変更されていないとして、私は

<p ng-if="!old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have created a new account with ’{{ new_email }}‘, for you on<br> Plobal Apps to preview and test your app and mailed you the details. Please check your inbox. 
</p> 

<p ng-if="new_user &amp;&amp; old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have created a new account with ’{{ new_email }}‘, for you on<br> Plobal Apps to preview and test your shopify app and mailed you the details. Please check your inbox. 
    <br> 
    You have been logged out of the previous account with ’{{ old_email }}‘. 
</p> 

<p ng-if="existing_user &amp;&amp; old_email" style="line-height: 20px; font-weight: normal;"><b>Hi,</b><br><br> 
    We have logged you in with ’{{ new_email }}‘, on Plobal Apps to preview and test your shopify app. 
    <br> 
    You have been logged out of the previous account with ’{{ old_email }}‘. 
</p> 

を見つけました。 セレンに角型ng-if条件を実行してから要素を探す方法を知っていれば助けてください。

+0

分度器の使用を検討するとよいでしょう。これはセレンの上に構築され、角度イベントをサポートします。 http://angular.github.io/protractor/#/ –

+1

innerHTMLを取得する前に十分な待機時間がありますか? – Buaban

答えて

2

次のコードが実際に存在している場合は再確認してください:

ng-if="new_user &amp;&amp; old_email" 

最初にそれがあったので:

ng-if="new_user && old_email" 

すなわち、セレンは、NG-場合

&amp;&amp; 

によって& &記号を置き換え、それが問題の根本だように見えます:「非JS」のコードを解析することができない角度(または、それは間違って解釈する)

PS同じことが、次のコードである:

ng-if="existing_user &amp;&amp; old_email" 

すなわち

&amp;&amp; 

本代わりにすぎNG-IF& &あります。

+0

貴重なご回答ありがとうございました。 – Sumit2500

関連する問題