Use tryto[functionname]. try to in front of the function name doesn't cause codeception to return an error if its not found.
if ($I->tryToSeeElement('.alert')) { $I->waitForText('Do you accept cookies?'); $I->click('Yes'); }