mardi 4 août 2020

testcafe conditional if else web element how continue to next condition if first one failed

   if (btnSubmit.exists) {
        await t.click(btnSubmit) //this failed due to button not exist actual is stopped in here
   } else if (buttonOK.exists) {
        await t.click(buttonOK) //i want to continue to execute this button which is exist
    } else {
        console.log("foo")
    }

I have simple code like this, running automation incase if first condition not found web element then continue next condition but actual is keep failing and stop in first condition

enter image description here

Aucun commentaire:

Enregistrer un commentaire