How to check that an attribute not exists in an element with PHPUnit?
You can check if there is a matching element for #edit-pass which has the attribute. Because #edit-pass targets only one element this has the same result when you know that this element exists:

$this-&gt;assertSession()-&gt;elementNotExists('css', '#edit-pass[autocomplete]');