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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
' Clic sur le bouton de validation
' Browser.getElementByXPath("//a[@href='" & LIEN & "/']").click
' Browser.getElementByCss("a[href='" & LIEN & "/']").click
'
' Application.StatusBar = strFormattedMsg
'
' <a class="button" href="download-as-zip">Télécharger les fichiers joints</a>
'Browser.getElementByCss("a[href='download-as-zip']").click
'Browser.getElementByCss ("a[href*='download-as-zip']")
'Set Links = Browser.getElementsByTagName("a") ' Récupérer tous les liens
'For i = 0 To Links.length - 1
' If InStr(Links(i).href, "download-as-zip") > 0 Then
' Set btn = Links(i)
' btn.click
' Exit For
' End If
'Next i
'Set btn = Browser.getElementByCss("a[href*='download-as-zip']")
'If Not btn Is Nothing Then
' Browser.ExecuteScript "arguments[0].click();", btn
'End If
'Browser.ExecuteScript "document.evaluate('/html/body/div[3]/aside/div/div[2]/p/a', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();"
'Browser.ExecuteScript "var link = document.querySelector('/html/body/div[3]/aside/div/div[2]/p/a'); if (link && !link.disabled && link.offsetHeight > 0) { link.click(); }"
'Browser.getElementByCss("a.button[href*='download-as-zip']").click
'Browser.ExecuteScript "document.querySelector('aside').style.display = 'block';"
'Browser.ExecuteScript "document.querySelector('/html/body/div[3]/aside/div/div[2]/p/a').click();"
' Déplier la sidebar
'Browser.ExecuteScript "document.getElementById('sidebar-toggle').click();"
' Cliquer sur le lien "Télécharger les fichiers joints"
'Browser.ExecuteScript "document.querySelector('.sidebar-download-files a').click();"
'Browser.ExecuteScript "var btn = document.querySelector('.sidebar-download-files a');" & _
' "if (btn) { var event = new MouseEvent('click', { 'bubbles': true, 'cancelable': true, 'view': window });" & _
' "btn.dispatchEvent(event); } else { console.log('Bouton non trouvé'); }"
'Browser.ExecuteScript "var btn = document.evaluate('/html/body/div[3]/aside/div/div[2]/p/a', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" & _
' "if (btn) { btn.click(); } else { console.log('Bouton non trouvé'); }"
'Set btn = Browser.getElementByCss("a.button")
'If Not btn Is Nothing Then
' btn.click
'End If
' Set btn = Browser.getElementByCss("a.button")
'
'' Attendre un peu avant de cliquer pour s'assurer que l'élément est interactif
'Application.wait (Now + TimeValue("00:00:02")) ' Attend 2 secondes
'
'If Not btn Is Nothing Then
' btn.click
' MsgBox "Bouton cliqué !"
'Else
' 'MsgBox "Le bouton n'a pas été trouvé."
'End If
'Browser.ExecuteScript "document.querySelector('a.button').click()" |
Partager