-1

I can't click "sign up" button on Spotify sign up page . I found button xpath or css but I can't click. I tried "click text" but same result.

WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,'/html/body/div[2]/main/div/div/form/div[9]/div'))).click()
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
ggforces
  • 35
  • 3

1 Answers1

0

To click on the Sign up element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    driver.get('https://www.spotify.com/in-en/signup')
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div#onetrust-close-btn-container>button[aria-label='Close']"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input#email"))).send_keys("ggforces@stackoverflow.com")
    driver.find_element(By.CSS_SELECTOR, "button[type='submit']>div").click()
    
  • Using XPATH:

    driver.get('https://www.spotify.com/in-en/signup')
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@id='onetrust-close-btn-container']/button[@aria-label='Close']"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='email']"))).send_keys("ggforces@stackoverflow.com")
    driver.find_element(By.XPATH, "//button[@type='submit']/div").click()
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
  • Browser Snapshot:

spotify_signup

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352