I have a util function as below:
public static boolean isWebElementEnabled(WebElement element) { try { return element.isEnabled(); } catch (Exception exx) { return false; }}public static boolean chkForThisElement(WebElement myElement) { try { return myElement.isDisplayed(); } catch (Exception e) { // TODO Auto-generated catch block return false; }}I call it like this in the base class:
public static boolean isusernameBoxEnabled = isWebElementEnabled(unameBox); public static boolean ispWordBoxEnabled = isWebElementEnabled(pwordBox);public static boolean issubmitBtnEnabled = isWebElementEnabled(submitBtn);public static boolean isctrsDrpdwnEnabled = isWebElementEnabled(multyCts);When I test it in the Test class, it always returns false. I tried diff ways of testing for existence, but it only returns false.
@Test(priority=1)public void verifyLoginpagecontrols() { Assert.assertTrue(isusernameBoxEnabled); Assert.assertTrue(ispWordBoxEnabled); Assert.assertTrue(issubmitBtnEnabled); Assert.assertTrue(isctrsDrpdwnEnabled);}






