Find element without ID tag and Name

0

Expensive,

I need to find the element that does not contain id or name in HTML.

Below is the example HTML

    <button type="button" class="btn btn-primary ng-scope" data-ng-if="novo2()" data-ng-click="novo()" clickonce="">
                Criar Protocolo
   </button>
    
asked by anonymous 28.02.2018 / 21:23

2 answers

0

Try to find through the element's Xpath. This is usually the easiest way when you do not have a unique identifier.

    
28.02.2018 / 21:56
0

Well, I do not understand why I did not create an id or a name, but for every case:

document.getElementsByTagName('button')

This will give you a list with all the "<" button ">" of the program, so you can find by indexing:

document.getElementsByTagName('button')[0]
    
28.02.2018 / 23:40