I am attempting to verify the URL of an image within a div element's background property in the CSS for the webpage. However, when I retrieve the CssValue and display it, it appears to be blank.
The HTML structure for the div is as follows:
<div class="Welcome">
<h3>Welcome</h3>
.......
</div>
Here is the CSS styling for the div:
div.Welcome {
background: rgba(0, 0, 0, 0) url("imageurl") no-repeat scroll center 25px;
float: left;
margin: 50px 20px 50px 150px;
padding-top: 230px;
width: 300px;
}
I have attempted to locate the image URL using the following code:
WebElement WelcomeImg = driver.findElement(By className("Welcome"));
String WelImg = WelcomeImg.getCssValue("background");
Assert.assertTrue(WelImg.contains("imageurl"));
I have also tried using:
("background-url");
Any assistance on this matter would be highly appreciated.