0

I would like to target a button that contains the name ="loginButton", and click the element after loading etc so it doesnt click on the loading spinner. How do I go about this webdriverwait targetting the name element?

from selenium.webdriver.support.wait import WebDriverWait 
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((find_element_by_name('loginButton'), "loginButton"))).click()
natisaver
  • 69
  • 1
  • 7

1 Answers1

1

You are almost correct.
For the provided example try using following code:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

element = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.NAME, "loginButton")))

element.click();

See here for more explanations

Prophet
  • 32,350
  • 22
  • 54
  • 79