I'm trying to verify whether profile image is present after uploading an image. Image uploads successfully. I have try to verify image with two different ways.
profileImage= driver.findElement(By.xpath("//img[@class='rounded-circle']"));
Boolean imagePresent = (Boolean) ((JavascriptExecutor)driver).executeScript("return arguments[0].complete && typeof arguments[0].naturalWidth != \"undefined\" && arguments[0].naturalWidth > 0", profileImage);
This returns false even though there is an image uploaded.
Boolean imagePresent = profileImage.isDisplayed();
This returns True.
Please can someone explain why I get two results. which one is correct to use?