Here is the sample:
WebElement LoginLabel = driver.findElement(location);
assert LoginLabel.getAttribute("textContent").equals("Login ID");
Above code fails while asserting but when I try to print the textContent, Eclipse console shows only Login ID (which is expected).
WebElement LoginLabel = driver.findElement(location);
String S = LoginLabel.getAttribute("textContent");
System.out.println(S);
assert LoginLabel.getAttribute("textContent").equals("Login ID");
It is throwing
java.lang.AssertionError
while executing last line.
Test case successfully running when I use 'contains'. as shown below
assert LoginLabel.getAttribute("textContent").contains("Login ID");
What is the difference between contains and equals here. Is it fine to use contains or Am I missing something. Please help me with this. I am new to selenium.