I am running a test to check whether the element is displayed or not, for this am using
isDisplayed() method. This method gets the correct state of that element(True/False), my requirement is to compare this Boolean value(True/False) with the Value given in another text file. On comparing the two values the test fails although it should pass.
This is my code:
String expected = //Passing the expected value from text file.
Boolean actual = driver.findElement(By.xpath(//xpath).isDisplayed();
Assert.assertEquals(expected, actual);.![The image below show shows the debug view of both the variables][1]
Try to use
Boolean.valueOf(String s)instead comparingBooleanwithString. Soexpectedshould beBoolean.valueOf(String s).