Find Elements by their Attribute in Python Selenium WebDriver Find Elements by their Attribute in Python Selenium WebDriver selenium selenium

Find Elements by their Attribute in Python Selenium WebDriver


To find all the <td> tags which have attribute data-sortable-id you can use the following granular xpath :

"//table[@id='product']/tr//td[@data-sortable-id]"

Perhaps you need to induce WebDriverWait in-conjunction with expected_conditions clause as visibility_of_all_elements_located as follows :

x = WebDriverWait(webdriver, 30).until(EC.visibility_of_all_elements_located((By.XPATH, "//table[@id='product']//tr//td[@data-sortable-id]")))print(len(x))