需要找到使用selenium和python单击消息按钮的方法

需要找到使用selenium和python单击消息按钮的方法,python,selenium,xpath,selenium-webdriver,automation,Python,Selenium,Xpath,Selenium Webdriver,Automation,它根本不起作用。试试这个: //按钮[span=“Message”]感谢安德森 //按钮//span[contains(text(),'Send a message to')]谢谢你的回复,但我收到了这个异常:raise TimeoutException(message,screen,stacktrace)selenium.common.exceptions.TimeoutException:message:试试这个//span[contains(text(),'Send message to'

它根本不起作用。

试试这个:

//按钮[span=“Message”]
感谢安德森


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

谢谢你的回复,但我收到了这个异常:raise TimeoutException(message,screen,stacktrace)selenium.common.exceptions.TimeoutException:message:试试这个
//span[contains(text(),'Send message to')]
,或者你能发布完整的源代码吗,这将有助于LOT仍然不起作用,并且确保这是message button类的源代码,这也是问题所在,但这里是:message向Francesca Felder发送消息粘贴整个网页源代码,当前选择器可能正在选择多个元素,因此完整的源代码请尝试此操作并查看,
//按钮[contains(@aria label,'Send message to')]
尝试单击css选择器-by.css(“message anywhere button mn-person-card\uu person-btn-ext button secondary medium.link without invested state”)
<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>
clickit = wait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[span='Send a message to']")))
clickit.click()