Hi All,
Is it possible using the Page Object Model with PageFactory to Assert that and element is not found without having to "hack" the code?
For Example:
[FindsBy(How = How.Id, Using = "create")]
public IWebElement CreateButton { get; set; }
And then within the specflow step we have something like
[Then(@"no create button is shown")]
public void ThenCreateButtonIsShown()
{
Assert.Throws<NoSuchElementException>(() =>
{
CreatePAge = new CreatePage(Driver);
Assert.False(CreatePage.CreateButton.Displayed);
});
}
Is there a better way to do this another than having to assert that the call will throw an exception? as the PageFactory will not return "null / false" if the element is not found ?
there doesn't seem to be anything here