Bonjour,
J'avance petit à petit pour arriver à simuler le click sur les onglets, filtres de la page web ci dessous, tous ca depuis VBA:
Je n'arrive pas à activer la selection du filtre "Home"
Nom : Display Classement.png
Affichages : 466
Taille : 117,2 Ko
Voici le code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Sub anchors()
 
    Dim i As Long
    Dim IE As Object
    Dim IEDoc As Object
    ' Create InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")
    ' You can uncoment Next line To see form results
    IE.Visible = True 'tbc
 
    IE.navigate "https://www.whoscored.com/Regions/252/Tournaments/2/England-Premier-League" '13796
    ' Wait while IE loading...
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
Set IEDoc = IE.document
 
 
'******  All TAG "<a " under ID
Dim htmlTabResultatFilter As IHTMLElementCollection
Set htmlTabResultatFilter = IEDoc.getElementById("tournament-filter-standings").getElementsByTagName("a")
 
Dim element As HTMLGenericElement
 
For Each element In htmlTabResultatFilter
    Debug.Print element.innerText
    If element.innerText = "Overall" Then element.className = "option"
    If element.innerText = "Home" Then element.className = "option selected"
Next
'Solution 1: KO par le changement de Style
IE.document.getElementById("standings-13796").setAttribute("Style") = "display: block;" 'display: block;
IE.document.getElementById("standings-13796").setAttribute("Style") = "display: none;" 'display: block;
IE.document.getElementById("standings-13796").setAttribute("Style") = "display: block;" 'display: block;
'IE.document.getElementById("forms-13796").setAttribute("Style") = "display: block;"
 
'Solution 2: KO par le refresh
   'IE.Refresh ca ne march pas car ca me remet les filtres par defaut
'Solution 3: KO par le script
    IE.document.parentWindow.execScript "submitTransForm()", "JavaScript" 'KO, message d'erreur raised
    Set IE = Nothing
 
End Sub
Quelqu'un a t-il une idée?

Merci d'avance
Jerome