1

How to verify that icon is not displayed or icon is displayed on the page ?

Image: enter image description here

Here it is html code if icon is not displayed:

<td id="messageGrid_tccell1_7" class="txtleft dxgv"/>

Here it is html code if icon is displayed:

<td id="messageGrid_tccell2_7" class="txtleft dxgv">
<div class="locked" title="locked"/>
</td>
  • What is the behavior of this icon on webpage. Can explain more? – Shailendra Rathore Feb 28 '18 at 4:24
2

Easiest way is to use the ExpectedConditions class.

For example, if you call ElementIsVisible() with the locator of the inner <div> element it will only return true if it's there.

0

try the below code

WebElement element=driver.findelement(By.id("messageGrid_tccell2_7"))
if(element.isdisplay())
{
System.out.println("Image displayed")
}else{
System.out.println("Image notdisplayed")
}
  • "messageGrid_tccell2_7" is the cell in which there is an icon or not. The cell is still present. So, this code can not be used to verify the status of the icon. – Majkl Feb 27 '18 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.