Selenium DOM 在执行 Angular ng-if 条件后没有改变

Selenium DOM is not changed after execution of Angular ng-if condition

我们在具有 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 条件将根据要求动态执行和拾取标签。我在 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 ’suwarnawandhekar46@gmail.com‘, on Plobal Apps to preview and test your shopify app.
  <br>
  You have been logged out of the previous account with ’test@plobalapps.com‘.
</p><!-- end ngIf: existing_user && old_email -->

如果我用 selenium 打印父元素的 innerHTML 然后我发现

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

根据我的理解,Selenium DOM 在执行 Angular ng-if 条件后不会改变。 如果有人知道如何告诉 selenium 执行 angular ng-if 条件然后查找元素,请帮助我。

请重新检查以下代码是否真的存在:

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

因为最初是:

ng-if="new_user && old_email"

即看起来 Selenium 将 && 符号替换为

&amp;&amp;

ng-if 中,这是问题的根源:Angular 无法解析 "non JS" 代码(或解释不正确)

P.S。以下代码也是如此:

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

&amp;&amp;
ng-if 中也存在

而不是 &&