I have a web page that have an indicator if a specific stock is opened/closed. For that I want to set a if & else if statement. For some reason I get an error in eclipse.
*Note: Don't know if it helps, but if I copy/paste the code to a new empty class that is a 'Main' one, it works without any errors - so the structure of the code is Ok I guess.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class TestClock {
public static void chromeMethod(WebDriver driver) {
System.setProperty("webdriver.chrome.driver", "C:\\automation\\drivers\\chromedriver.exe");
}
public static void runTestClock(WebDriver driver)
{
WebElement Status = null;
if( Status == driver.findElement(By.cssSelector(".redClockBigIcon")));
{
System.out.println("Stock is closed");
driver.navigate().back();
}
else if (Status == driver.findElement(By.cssSelector(".greenClockBigIcon")) );
{
System.out.println("Stock is open");
driver.navigate().back();
}
}
}
I get a syntax error under 'else' :
Syntax error on token "else", delete this token
;.