<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()
根本不起作用。
答案 0 :(得分:1)
试试这个:
//button[span="Message"]
感谢Andersson
//button//span[contains(text(), 'Send a message to')]