0

Is there a way to access Tableau viz tool bar buttons like 'Refresh Data in this view' ? I have tried to locate tool bar elements by id and Xpath both but it throws an element not found exceptions every time.

After loading Tableau viz I am trying to locate the element

driver.implicitly_wait(20)
submit_button4 = driver.find_element(By.ID, 'refresh')
submit_button4.click()

but throws the below exception:

NoSuchElementException: Message: no such element: Unable to locate element

HTML snapshot:

enter image description here

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

1 Answers1

0

Remove implicitly_wait() completely replacing it with WebDriverWait and you can use either of the following locator strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button#refresh"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[@id='refresh']"))).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
  • 183,867
  • 41
  • 278
  • 352