-5

Here's my code:

<ul class="Buttons--stackOnMobile">
    <li class="col">
        <button class="Button">Sign In</button>
    </li>
    <li class="col col--secondary">
        <a class="Button Button--alt" href="/account/create">Create an Account</a>
    </li>
    <li class="col hide">
        <button class="Button">Sign In</button>
    </li>
</ul>

I'm trying to make selenium click on Sign in button.

I'm coding in Python 3.6.

Philipp
  • 745
  • 2
  • 7
  • 20
Trap Star
  • 25
  • 1
  • 6
  • 2
    Possible duplicate of [python selenium click on button](https://stackoverflow.com/questions/21350605/python-selenium-click-on-button) – Lucas Abbade Oct 29 '19 at 13:28
  • You need to post your python code. You have posted HTML so far. Also include the full error message that you get when running your current code. – JeffC Oct 29 '19 at 21:04

1 Answers1

1

There are two buttons are present with the same xpath.

if you want to click first button then use below code

wait = WebDriverWait(browser, 10)
button= wait.until(EC.element_to_be_clickable((By.XPATH,'(//button[@class="Button"])[1]')))
button.click()

if you want to click the second button then use below code

  wait = WebDriverWait(browser, 10)
    button= wait.until(EC.element_to_be_clickable((By.XPATH,'(//button[@class="Button"])[2]')))
    button.click()
SeleniumUser
  • 4,065
  • 2
  • 7
  • 30