1

I'm very newbie at this. I'm trying to login a website using Selenium to make some web scraping but I can't succeed in clicking the submit button.

This is what I'm using:

browser.find_element_by_name("submit").click()

And this is the html form code from the web:

<div _ngcontent-ihr-c27="" class="form-group">

<button _ngcontent-ihr-c27="" class="btn-fantasy green big" gtm-action="Login_Mail" gtm-category="Interaccion" gtmeventclick="" type="submit"> Iniciar sesión </button>

</div>

Any suggestion? Maybe using another attribute in find_element_by_XXX?

Thanks!

N3R4ZZuRR0
  • 2,400
  • 4
  • 18
  • 32
Javi
  • 13
  • 3

1 Answers1

0

Induce WebDriverWait And element_to_be_clickable() And following xpath option.

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='btn-fantasy green big' and @type='submit'][contains(.,'Iniciar sesión')]"))).click()

OR Css selector.

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.btn-fantasy.green.big[type='submit']"))).click()

You need to imports following.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
KunduK
  • 32,888
  • 5
  • 17
  • 41
  • 1
    I succeed using: ``browser.find_element_by_xpath('//button[@type="submit"]').click()`` – Javi Sep 28 '19 at 11:12