Home > Enterprise >  How to selec a data-toggle in Selenium?
How to selec a data-toggle in Selenium?

Time:09-09

enter image description here

I would like to click on one of these tabs but I am not able to access it.

How can I access the data-toggle with Selenium in python?

CodePudding user response:

Please try something like this:

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

wait = WebDriverWait(driver, 10)

wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class=='section-tabs']//a[contains(@href,'timeseries-tab')]"))).click()

The code above should be able to select the timeseries tab.
You did not share the xml of the other tab, but I guess this should work:

wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class=='section-tabs']//a[contains(@href,'heatplot-tab')]"))).click()

This can be also done with CSS Selectors.
To give better answer we need the link to that page or at least the entire XML of that page as a text, not picture

  • Related