2016-04-19 11 views
10

wir haben folgenden Code auf Seite, die Winkel ng-wenn Bedingung hat.Selenium DOM wird nicht nach der Ausführung von Angular geändert ng-if-Bedingung

<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-Bedingung wird dynamisch ausgeführt und Pick-Tags gemäß den Anforderungen. Ich habe auf HTML-Seite beobachtet, dass alles funktioniert. Ich beobachtete folgenden HTML-Code nach der Inspektion der Seite.

<!-- 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 --> 

Wenn ich von Selen innerHTML- von Elternelement drucke dann fand ich

<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> 

Gemäß meinem Verständnis ist Selen DOM nicht nach der Ausführung von Angular ng-if Zustand geändert. Bitte helfen Sie mir, wenn jemand weiß, wie man Selen anweist, angle ng-if-Bedingung auszuführen und dann nach Element zu suchen.

+0

Vielleicht möchten Sie Winkelmesser verwenden. Es ist auf Selen aufgebaut und unterstützt Winkelereignisse. http://angular.github.io/protractor/#/ –

+1

Haben Sie genug warten, bevor Sie das innereHTML bekommen? – Buaban

Antwort

2

Bitte überprüfen Sie noch einmal, wenn der folgende Code wirklich vorhanden ist:

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

Weil es ursprünglich war:

ng-if="new_user && old_email" 

D.h. es sieht aus wie Selen & & Symbole von

&amp;&amp; 

in ng-wenn und es ist die Wurzel des Problems ersetzt: Eckige kann nicht „nicht JS“ Code analysieren (oder interpretiert es falsch)

PS Dasselbe ist mit dem folgenden Code: anstelle von & & in ng-if zu

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

d.h.

&amp;&amp; 

vorhanden ist.

+0

danke für Ihre wertvolle Antwort, es ist nützlich für mich – Sumit2500