MDL-48374 behat: Check flag before searching for span on page