执行Angular ng-if条件后,Selenium DOM不会更改

Sum*_*500 10 java selenium qa selenium-webdriver angular-ng-if

我们在页面上有以下代码,它具有角度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>
Run Code Online (Sandbox Code Playgroud)

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 -->
Run Code Online (Sandbox Code Playgroud)

如果我用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>
Run Code Online (Sandbox Code Playgroud)

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

mar*_*bug 3

请重新检查以下代码是否确实存在:

ng-if="new_user &amp;&amp; old_email"
Run Code Online (Sandbox Code Playgroud)

因为最初是:

ng-if="new_user && old_email"
Run Code Online (Sandbox Code Playgroud)

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

&amp;&amp;
Run Code Online (Sandbox Code Playgroud)

ng-if中,这是问题的根源:Angular 无法解析“非 JS”代码(或错误地解释它)

PS同样的情况还有下面的代码:

ng-if="existing_user &amp;&amp; old_email"
Run Code Online (Sandbox Code Playgroud)

IE

&amp;&amp;
Run Code Online (Sandbox Code Playgroud)

也在ng-if中代替&&出现。