0

HTML snapshot 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.

undetected Selenium
  • 151,581
  • 34
  • 225
  • 281

3 Answers3

0
  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()

Whitney Liao
  • 35
  • 1
  • 7
0

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
Akzy
  • 579
  • 2
  • 12
0

To click on the element with text as Rebounds you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following solution:

driver.get("https://app.prizepicks.com/board")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[text()='Rebounds']"))).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
undetected Selenium
  • 151,581
  • 34
  • 225
  • 281