I'm using Laravel Dusk for several pages. Sometimes on that pages there arent the same ID's of elements and when some ID is changed my test fail.
Because of that, I'm using try{}
like:
try {
$browser->uncheck('optInEmail');
} catch (Exception $e) {
}
and this code works well where there is no element 'optInEmail'
but performance of the test if very poor because of the $e catch I think. Am I right?
My question is:
How to check does some element exist into the page before making some action on them or how I can prevent stop of DUsk test if the element is not on the page - I just want to finish all actions.
Basically, I want to prevent to see error messages - just want if some of the elements arent there to skip that to the next line of code. Is that possible?
Aucun commentaire:
Enregistrer un commentaire