Selenium DOM не изменяется после выполнения условия Angular ng-if
у нас есть следующий код на странице с условием 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 ’{{ 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 && 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 && 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 условие будет выполнять динамически и теги пикапа в соответствии с требованиями. Я наблюдал на 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 && 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 родительского элемента selenium, тогда я нашел
<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 && 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 && 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>
В соответствии с моим пониманием, Selenium DOM не изменяется после выполнения условия angular ng-if.
Пожалуйста, помогите мне, если кто-нибудь знает, как сказать селену выполнить условие angular ng-if, а затем искать элемент.
Ответы
Ответ 1
Пожалуйста, повторите проверку, если действительно присутствует следующий код:
ng-if="new_user && old_email"
Потому что изначально это было:
ng-if="new_user && old_email"
т.е. похоже, что Selenium заменяет символы & на
&&
в ng-if, и это корень проблемы: Angular не может разобрать код "не JS" (или интерпретирует его неправильно)
P.S. То же самое со следующим кодом:
ng-if="existing_user && old_email"
то есть.
&&
присутствует вместо & в ng-if.