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 change开发者_开发知识库s anything I am using browsermob.com to do the testing once I get it running through selenium ide.
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.
精彩评论