0

Hello I am trying to work on a side personal project for automating email accounts. I am relatively new to Selenium and am having trouble clicking the signup button. I have tried the two following methods but none of them seem to be working.

driver.find_element_by_xpath('//*[@link= "https://protonmail.com/signup"]').click()
driver.find_elements_by_link_text('SIGN UP').click()

This is what I see when I click inspect element on the sign up button by the way. There is no id or value that can will easily classify the button.

<a href="signup" class="btn btn-default btn-short">SIGN UP </a>
Guy
  • 46,488
  • 10
  • 44
  • 88
xHect
  • 19
  • 1
  • 7

2 Answers2

0

You can use the href attribute like this

driver.find_element_by_xpath('//*[@href="signup"]')

You can also locate by the text, but you need to take the space into account, so use partial text

driver.find_element_by_partial_link_text('SIGN UP')
Guy
  • 46,488
  • 10
  • 44
  • 88
  • Thank you! That did the trick. Would you mind explaining to me why this is the proper way to approach this situation? – xHect Nov 21 '19 at 07:24
  • @xHect the `href` is an attribute, and its value is `signup`. You need to use the attribute as is. – Guy Nov 21 '19 at 07:25
  • ooh ok, thank you for your assistance @Guy – xHect Nov 21 '19 at 07:32
0

I think you can use tag+value selector.

driver.find_element_by_css_selector("a[value='SIGN UP ']").click()
Raymond Reddington
  • 1,709
  • 1
  • 13
  • 21