需要找到一种方法来使用selenium和python

时间:2017-06-18 17:14:15

标签: python selenium xpath selenium-webdriver automation

<button aria-label="Send message to Francesca Felder" class="message-anywhere-button mn-person-card__person-btn-ext button-secondary-medium link-without-visited-state" data-ember-action="" data-ember-action-1634="1634">
<span aria-hidden="true">Message</span>
<span class="visually-hidden">
    Send a message to Francesca Felder
</span>

上面是我尝试使用Selenium Webdriver点击的按钮类。

我试过这样做:

clickit = wait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[span='Send a message to']")))
clickit.click()

根本不起作用。

1 个答案:

答案 0 :(得分:1)

试试这个:

//button[span="Message"]感谢Andersson

//button//span[contains(text(), 'Send a message to')]