How to click on the dropdown item with text as (Select All) with Selenium and Python How to click on the dropdown item with text as (Select All) with Selenium and Python selenium selenium

How to click on the dropdown item with text as (Select All) with Selenium and Python


To click on the dropdown option with text as (Select All) as the elements are JavaScript enabled element you need to induce WebDriverWait for the desired element to be clickable and you can use the following solution:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[contains(@id, '_divDropDown') and contains(@onclick, 'cancelBubble')][contains(@onactivate, 'cancelBubble')]"))).click()WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[contains(@id, '_divDropDown') and contains(@onclick, 'cancelBubble')][contains(@onactivate, 'cancelBubble')]/span/div/table/tbody/tr/td/span//label[contains(@for, '_divDropDown_') and contains(., '(Select All)')]"))).click()

Note : You have to add the following imports :

from selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support import expected_conditions as EC