Cliquez sur un élément hypertexte en fonction de sa valeur de innertext
asmatte
Messages postés
3
Date d'inscription
Statut
Membre
Dernière intervention
-
yg_be Messages postés 23541 Date d'inscription Statut Contributeur Dernière intervention -
yg_be Messages postés 23541 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Je ne peux pas résoudre ce problème : cliquez sur un élément hypertexte en fonction de sa valeur de innertext (TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A))
Normalement, une fois que vous avez cliqué sur l'élément hypertexte, IE charge une autre page. Je voudrais donc pouvoir choisir le tableau : TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A).
J'ai essayé différentes manipulations (voir ci dessous):
Manipulation n1:

Manipulation n2:

Manipulation n3:
Rien ne se passe!
Manipulation n4:
Rien ne se passe!
Manipulation n5:
Rien ne se passe!
Ci dessous le code HTML:
Je ne peux pas résoudre ce problème : cliquez sur un élément hypertexte en fonction de sa valeur de innertext (TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A))
Normalement, une fois que vous avez cliqué sur l'élément hypertexte, IE charge une autre page. Je voudrais donc pouvoir choisir le tableau : TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A).
J'ai essayé différentes manipulations (voir ci dessous):
Manipulation n1:
Set oHTML = IE.document With oHTML oHTML.querySelector ("[href=javascript:gotoinforme('tablero/tbl25_frames.jsp','GRUPO1','TBL25B')]") End With

Manipulation n2:
Set oHTML = IE.document With oHTML oHTML.execScript "gotoinforme('tablero/tbl25_frames.jsp','GRUPO1','TBL25B')", "JScript" End With

Manipulation n3:
Dim element As HTMLLinkElement Dim elementcol As IHTMLElementCollection Dim link As HTMLAnchorElement Set oHTML = IE.document Set elementcol = oHTML.getElementsByTagName("a") For Each element In elementcol If InStr(element.innerText, "TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A)") Then Call element.Click Exit For End If Next
Rien ne se passe!
Manipulation n4:
Dim element As HTMLLinkElement Dim elementcol As IHTMLElementCollection Dim link As HTMLLinkElement Dim i As Integer Set oHTML = IE.document Set link = Nothing i = 0 While i < oHTML.Links.Length And link Is Nothing Debug.Print oHTML.Links(i).innerText, oHTML.Links(i).href If oHTML.Links(i).innerText = "TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A)" Then Set link = oHTML.Links(i) i = i + 1 End If Wend If Not link Is Nothing Then link.Focus link.Click Else End If
Rien ne se passe!
Manipulation n5:
Dim coll_Li As IHTMLElementCollection Dim Li As HTMLGenericElement Set oHTML = IE.document Set coll_Li = oHTML.getElementsByTagName("a") For Each Li In coll_Li If Li.innerText = "TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A)" Then Li.Click Exit For End If Next
Rien ne se passe!
Ci dessous le code HTML:
</SCRIPT> </head> <body bgcolor="#ffffff" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" onload="doAbrirMenu('GRUPO1')" > <!-- --> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="100%" valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr valign="top"> <td width="60%" align="center" id="tdMenu"> <!-- MENU --> <br> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td width="5"></td> <td width="10" background="images/P/contenu_fondtitre.gif"><img width="1" height="1" src="images/P/spc.gif"> </td> <td class="pTitreC" style="cursor:pointer;" onclick="doAccionMenu('GRUPO1')" nowrap="">Direction Générale</td> <td align="right" class="iAction" onclick="doAccionMenu('GRUPO1')"><img id="imgGRUPO1" src="images/P/triangle_dw.gif"> </td> <td align="right" width="100%" background="images/P/contenu_fondtitre.gif"></td> </tr> </table> <table cellpadding="5" cellspacing="0" border="0" width="100%" id="tblGRUPO1" style="display:none;"> <tr> <td width="5"></td> <td width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25" align="center" valign="top" bgcolor="#F2F2F2"><img src="images/P/puce_on.gif" vspace="3" width="9" height="10"> </td> <td width="100%" valign="top" bgcolor="#F2F2F2"><a href="javascript:gotoInforme('tablero/tbl02tp_frames.jsp','GRUPO1','TBL02TP')" class="pMenu">TG01B-P - Suivi des objectifs par pays (TG01) </a> </td> </tr> <tr> <td width="25" align="center" valign="top" bgcolor="#F2F2F2"><img src="images/P/puce_on.gif" vspace="3" width="9" height="10"> </td> <td width="100%" valign="top" bgcolor="#F2F2F2"><a href="javascript:gotoInforme('tablero/tbl25_frames.jsp','GRUPO1','TBL25B')" class="pMenu">TG01A-P - Suivi des objectifs par pays (yc production DI) (TG01A) </a> </td> </tr> <tr>
A voir également:
- Cliquez sur un élément hypertexte en fonction de sa valeur de innertext
- Fonction si et - Guide
- Cliquez sur ce lien. en n'utilisant que le clavier, quel mot obtenez-vous ? ✓ - Forum Windows
- Durée de fonctionnement processeur ✓ - Forum Windows 10
- Faites afficher avec un fond coloré les cellules qui contiennent une valeur comprise entre 250 et 350. quel nombre est dessiné en surbrillance ? ✓ - Forum Excel
- Inspecter l'élément mac ✓ - Forum MacOS
2 réponses
yg_be
Messages postés
23541
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 584
bonjour,
qu'as-tu fait pour comprendre ce que fait ton code?
sais-tu comment faire ce genre d'investigation?
prenant comme exemple ta manipulation 5, j'ajouterais
après la ligne 6.
qu'as-tu fait pour comprendre ce que fait ton code?
sais-tu comment faire ce genre d'investigation?
prenant comme exemple ta manipulation 5, j'ajouterais
debug.print Li.innerText
après la ligne 6.