Home > Enterprise >  How can I use selenium to click a button that looks like this?
How can I use selenium to click a button that looks like this?

Time:04-22

Example of website:

The button is the rebounds button on 'https://app.prizepicks.com/board'. I've tried using the copy xPath feature, but that does not work.

CodePudding user response:

  1. Try to wait until the elements show up or use time.sleep()

  2. Below xpath works for me

    rebounds_btn = driver.find_element_by_xpath('//*[contains(text(), "Rebounds")]') rebounds_btn.click()

CodePudding user response:

Try the below,

   WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.XPATH, "//*[contains(text(), 'Rebounds')]"))).click()

do not forget to import

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