2016-04-19 9 views
10

abbiamo il seguente codice sulla pagina che presenta una condizione angolare ng-if.Il DOM del selenio non viene modificato dopo l'esecuzione della condizione Angular ng-if

<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 condizione eseguirà dinamicamente e tag di prelievo secondo i requisiti. Ho osservato sulla pagina html che tutto funziona. Ho osservato il seguente codice html dopo aver ispezionato la pagina.

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

se stampo innerHTML dell'elemento genitore da selenio poi ho trovato

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

Come per la mia comprensione, Selenio DOM non è cambiato dopo l'esecuzione di angolare ng-se la condizione. Per favore aiutatemi se qualcuno sa come dire al selenio di eseguire la condizione angolare ng-if e quindi cercare l'elemento.

+0

È possibile considerare l'utilizzo del rapportatore. È costruito sopra il selenio e supporta eventi angolari. http://angular.github.io/protractor/#/ –

+1

Hai abbastanza attesa prima di ottenere il innerHTML? – Buaban

risposta

2

Si prega di ricontrollare se il seguente codice è realmente presente:

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

Perché inizialmente era:

ng-if="new_user && old_email" 

Vale a dire sembra che il selenio sostituisce & & simboli da

&amp;&amp; 

in ng-se ed è la radice del problema: angolare non può analizzare il codice "non JS" (o lo interpreta in modo errato)

PS Lo stesso con il seguente codice:

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

cioè

&amp;&amp; 

è presente invece di & & in ng-se troppo.

+0

grazie per la tua preziosa risposta, è utile per me – Sumit2500

Problemi correlati