我已经阅读了所有以前的文章以找到解决方案,但我仍在为VBA争取Selenium。
我想单击一个名为“ telecharger la page”的按钮。 HTML代码如下:
<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>
我已经尝试过使用此VBA代码,但是它不起作用...
bot.FindElementsByXPath("//tr[@id=':y']").Click.FindElementsByTag("Télécharger la table").Click
有人可以帮我吗?
谢谢!
答案 0 :(得分:1)
这是您可以使用的xpath。
//tr[@id=':y']//i[@title='Télécharger la table']
bot.FindElementByXpath("//tr[@id=':y']//i[@title='Télécharger la table']").click
答案 1 :(得分:0)
似乎您在另一个元素中找到一个元素。仅使用xpath即可实现。尝试使用以下xpath:
myMap.emplace(std::piecewise_construct,
std::forward_as_tuple("someKey"),
std::tuple<>{});
答案 2 :(得分:0)
要单击元素,可以使用以下Locator Strategies中的任何一个:
使用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
使用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