Hello I was just wondering how this line of code works (it has been divided into two to be more readable)
Am I correct in saying that the findElements method finds elements with the CSS selector “h2#main-login” and then loads them into an array? The size method is then used to check if the length of that array is equal to 0?
What then happens if the array is a size of 0? Is the message “Not redirecting to login page” displayed by the assertFalse?
assertFalse("Not redirecting to login page",
driver.findElements(By.cssSelector("h2#main-login")).size() == 0);
Any kind of explanations in helping me understand this would be appreciated massively.
is a workaround to check if the element is present
would also be possible..
if this is not false (true) the Message
"Not redirecting to login page"is attached to the AssertionException for debugging reasons
Better: