samedi 23 décembre 2017

Continue statement if element is not found

How do I continue the click() method if Topping3 and Topping4 are not found? Currently, it seems to break the script.

if (condition1)
   statement1
else if (condition2)
   statement2
else if (condition3)
   statement3

else(document.getElementsByName("Topping1").length > 0) {
    document.getElementsByName("Topping2")[0].selectedIndex = 1;
    document.getElementsByName("Topping3")[0].selectedIndex = 2;
    document.getElementsByName("Topping4")[0].selectedIndex = 3;
    document.getElementById('Submit').click();
}   

Aucun commentaire:

Enregistrer un commentaire