0
<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>

Above is the button class I am trying to click using Selenium Webdriver.

I have tried doing this:

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

It doesn't work at all.

1
  • Try to click on the css selector - by.css("message-anywhere-button mn-person-card__person-btn-ext button-secondary-medium.link-without-visited-state") Commented Jun 18, 2017 at 22:13

1 Answer 1

1

Try this :

//button[span="Message"] Thanks to Andersson

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

Sign up to request clarification or add additional context in comments.

7 Comments

Thank you for the reply, but I am getting this exception: raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:
try this //span[contains(text(), 'Send a message to')] , or can you post the full page source, it will help a lot
Still doesnt work and sure this is the source of the message button class, it's also in the question as well but here it is: <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>
paste the entire web page source, there might be multiple elements which the current selector is selecting, so complete source
please try this and see , //button[contains(@aria-label, 'Send message to')]
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.