Vba interacting with IE

-1

I need to click on an element of a website:

TheproblemisthatthereareseveraloftheseandImadethiscode:

ForEachobjInie.Document.allobj.ClickNext

ButthiscodeclicksonalltheobjectsonthepagecannotIjustgetspecificicons?

Thereisnoie.Document.allthatdoestheobj.clickfunctiononlyinthepartthatarethebuttonsthatIwanttoclickoracodethatonlyclickstheobjectsthathaveinitsclass:"clickable" to not click in all of the page.

    
asked by anonymous 10.04.2018 / 16:18

2 answers

1

Good morning,

Try this:

For Each obj In ie.Document.all
    if obj.id = "img_684517_43_2506" then
        obj.Click
    end if
Next
    
26.04.2018 / 15:38
0

If the objects you want to click are those of class clicavel , just iterate using the getElementsByClassName method:

For Each obj In IE.Document.getElementsByClassName("clicavel")
    obj.Click
Next

If there are only a few objects in the clickable class, put if inside for , to just click on the ones you want.

    
29.04.2018 / 17:11