-1

I have read all the former posts to find the solution but I am still struggling with Selenium for VBA.

I would like to click on a button called "telecharger la page". The HTML code is below :

<tbody class="template-list">
<tr id=":y" class="goog-container">
<td>
<i class="icon foundicon-down-arrow pointer download-button general" title="Télécharger la table">
</i>

I have tried with this VBA code but it does not work...

bot.FindElementsByXPath("//tr[@id=':y']").Click.FindElementsByTag("Télécharger la table").Click

Could somebody help me?

thanks!

Guy
  • 46,488
  • 10
  • 44
  • 88

3 Answers3

1

Here is the xpath that you can use.

//tr[@id=':y']//i[@title='Télécharger la table']

enter image description here And you code should be

bot.FindElementByXpath("//tr[@id=':y']//i[@title='Télécharger la table']").click
supputuri
  • 13,644
  • 2
  • 21
  • 39
0

It seems that you are finding an element in another element. That can be achieved using xpath only. Try using below xpath:

bot.FindElementsByXPath("//tr[@id=':y']/i").Click
Deepak Kumar
  • 106
  • 7
0

To click on the elelemtn you can use either of the following Locator Strategies:

  • Using FindElementByCss:

    bot.FindElementByCss("tr.goog-container[id$='y']>td>i.icon.foundicon-down-arrow.pointer.download-button.general[title='Télécharger la table']").Click
    
  • Using FindElementByXPath:

    bot.FindElementByXPath("//tr[@class='goog-container' and contains(@id, 'y')]/td/i[@class='icon foundicon-down-arrow pointer download-button general' and @title='Télécharger la table']").Click
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352