Skip to content
Advertisement

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

we have following code on page which has angular ng-if condition.

JavaScript

ng-if condition will execute dynamically and pickup tags as per requirements. I have observed on html page that everything is working. I observed following html code after inspecting page.

JavaScript

If I print innerHTML of parent element by selenium then I found

JavaScript

As per my understanding, Selenium DOM is not changed after execution of Angular ng-if condition. Please help me if anyone knows how to tell selenium to execute angular ng-if condition and then look for element.

Advertisement

Answer

Please recheck if the following code is really present:

JavaScript

Because initially it was:

JavaScript

I.e. it looks like Selenium replaces && symbols by

JavaScript

in ng-if and it’s the root of the issue: Angular can’t parse “non JS” code (or interprets it incorrectly)

P.S. The same is with the following code:

JavaScript

i.e.

JavaScript

is present instead of && in ng-if too.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement