Else if
else if comes into play when the previous if condition or another else if condition is false. It is used to check another condition. If the condition inside the else if is true, the code block inside it is executed. This allows for checking multiple conditions and performing different actions based on various outcomes.
Parameters
- Conditions - To control the flow using commands like if
RpScript
How to use
Pupet.OpenBrowser({ headless: false, browser: "Chrome" });
var pageResponse = Pupet.Visit("https://erametricras.com/");
var waitOptionForVisible = Pupet.WaitOptionForVisible(true, 10000);
var products= Pupet.ElementIsExists(pageresponse.page, "li#menu-item-1502 > a:nth-child(1) > div.tdb-menu-item-text", null, WaitOptionForVisible);
if (products== false) {
Assert.Throw("The Products button is not available.");
} else if (Pupet.ElementIsExists(pageresponse.page, "li#menu-item-549 > a:nth-child(1) > div.tdb-menu-item-text", null, WaitOptionForVisible) == false) {
Assert.Throw("No other button is available.");
}
Pupet.CloseBrowser();
Extension
