I have to assert whether the page has button enabled or not but each time I run my code I get the mentioned error. Can anyone please have a look at this ?
Here is my class that has selector for the button.
public class DynamicProperties {
WebDriver driver;
//Constructor that will be automatically called as soon as the object of the class is created
public DynamicProperties(WebDriver driver) {
this.driver = driver;
}
//Locators for the page title and the logout button
By vis = By.xpath("//button[@id=enableAfter']");
WebElement visibleAfterFive = driver.findElement(vis);
Boolean button = visibleAfterFive.isDisplayed();
public Boolean getButton() {
return button;
}
}
And here is my Test Case Running Class:
public class TestCase9_DynamicProperties {
@Test(priority=1, description = "Testing the button")
public void checkEnableAfter() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "Link to chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://demoqa.com/dynamic-properties");
DynamicProperties DP = new DynamicProperties(driver);
Thread.sleep(5000);
boolean button = DP.getButton();
boolean actualValue = true;
Assert.assertEquals(button,actualValue);
driver.quit();
}
}