I have a page that I want to check with selenium that uses a certain background image for one element. I want to ensure that this image still exists on the page connected to the element. How would I do this with selenium. If this changes anything I am using browsermob.com to do the testing once I get it running through selenium ide.
Asked
Active
Viewed 507 times
0
-
possible duplicate of [Asserting the background image of a page with selenium](http://stackoverflow.com/questions/1799173/asserting-the-background-image-of-a-page-with-selenium) – Dave Hunt Sep 26 '10 at 08:23
1 Answers
1
Well aside from the suggested things on the almos duplicate issue... You could check if the property of your body element is set to the image.
By if getAttribute returns a valid value or not. Like:
new Wait()
{
public boolean until()
{
return selenium.getAttribute("ElementLocator")
+ "@class").equals("active");
}
}.wait("The menu item did not get active.",
defaultTimeOutValue);
This will wait for the attribute @class to have the value "active".
Or simply use an If statement after you are sure that the page got loaded.
Hope this helps, Cheers, Gergely.

Hannibal
- 1,078
- 2
- 12
- 24