How to check if one element exist in html with imacros

bilgamyompi

Newbie
Joined
Feb 14, 2018
Messages
17
Reaction score
0
I just want to check if this span exist using imacros (or javascript) so i can check the tag exists, some way to check the existence of this tag.

<span data-bind="visible: !Show()" class="glyphicon glyphicon-remove negative-color" style="">::before</span>
I only want to check the existence of the tag or icon, reference https://www.w3schools.com/code/tryit.asp?filename=G6L2611AZZDX

Sometimes the page doesnt display the tag, so how i can check this. the reference is just an example.
 
Here is the line of JS code:
Code:
var exists = document.querySelectorAll('.glyphicon.glyphicon-remove.negative-color').length > 0;
If you need to check visibility (not just an existance), then it should be like:
Code:
var exists = document.querySelectorAll('.glyphicon.glyphicon-remove.negative-color:visible').length > 0;
 
Back
Top