How to click on a element through Selenium Python

The element with text as Export is a dynamically generated element so to locate the element you have to induce WebDriverWait for the element to be clickable and you can use either of the Locator Strategies:


    WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a.layerConfirm>div[data-hover="tooltip"][data-tooltip-display='overflow']"))).click()
  • Using XPATH:

    WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[contains(@class, 'layerConfirm')]/div[@data-hover="tooltip" and text()='Export']"))).click()
  • Note : You have to add the following imports :

    from import WebDriverWait
    from import By
    from import expected_conditions as EC

Leave a Comment