Ebola57 Posted March 9, 2018 Posted March 9, 2018 (edited) Hello After trying some Web's solutions, didn't figure out my problem ... I'd like to click on a 'label' link called "Recherche avancée" that is managed by some Javascript Here's HTML code <tr> <input type="submit" name="action.standardsearch.search" value="Rechercher" class="im-button" id="imh_1" /></td> </tr> <tr> <td align="right"><label style="text-decoration: underline;cursor:pointer;" onclick="imSubmitAction('action.standardsearch.detailed');">Recherche avancée</label></td> </tr> <tr> <td>La recherche ne peut renvoyer plus de 500 résultats.<BR>Si vous ne trouvez pas le compte recherché, veuillez affiner vos critères de recherche.</td> </tr> Tried this unsuccesfully $oLabels = _IETagNameGetCollection ($oIE,"label") For $oLabel In $oLabels If $oLabel.Onclick = "imSubmitAction('action.standardsearch.detailed');" Then _IEAction($oLabel,"click") ExitLoop EndIf Next May you help me please to fix this issue ? Regards Edited March 9, 2018 by Ebola57
Danp2 Posted March 9, 2018 Posted March 9, 2018 A couple of suggestions -- 1) Add a ConsoleWrite or a MsgBox inside the If statement so that you can be sure the desired element is being found 2) Instead of checking for onclick, it may work better to check for innertext -- $oLabels = _IETagNameGetCollection ($oIE, "label") For $oLabel In $oLabels If _IEPropertyGet($oLabel, 'innertext') = "Recherche avancée" Then ConsoleWrite('Found element!' & @CRLF) _IEAction($oLabel,"click") ExitLoop EndIf Next Ebola57 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Juvigy Posted March 9, 2018 Posted March 9, 2018 Try : $oIE.document.parentwindow.execScript("imSubmitAction('action.standardsearch.detailed');") Ebola57 1
Ebola57 Posted March 9, 2018 Author Posted March 9, 2018 35 minutes ago, Juvigy said: Try : $oIE.document.parentwindow.execScript("imSubmitAction('action.standardsearch.detailed');") That's a flawless success ! Thanks a lot. At least now I learnt how to exce some part of J code
Ebola57 Posted March 9, 2018 Author Posted March 9, 2018 1 hour ago, Danp2 said: A couple of suggestions -- 1) Add a ConsoleWrite or a MsgBox inside the If statement so that you can be sure the desired element is being found 2) Instead of checking for onclick, it may work better to check for innertext -- $oLabels = _IETagNameGetCollection ($oIE, "label") For $oLabel In $oLabels If _IEPropertyGet($oLabel, 'innertext') = "Recherche avancée" Then ConsoleWrite('Found element!' & @CRLF) _IEAction($oLabel,"click") ExitLoop EndIf Next That is very pertinent indeed, going to do some test in this way even if I have to catch Juvigy's solution at the moment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now