Reputation: 13
Hi I would like to click on the Edit Filter button, which appears to be in the same tr for the Fiscal Yr item but in a different td.
This is what I tried:
driver.find_elements_by_xpath("//body//tr[@class='FilterEditCell']/td[2]/a[1]").click()
Could someone please guide me?
Thanks.
Upvotes: 0
Views: 141
Reputation: 52665
Try to use below XPath:
//td[contains(., "Fiscal Yr")]/following-sibling::td/a[img[@title="Edit Filter"]]
You might need to use ExplicitWait for dynamic nodes:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//td[contains(., "Fiscal Yr")]/following-sibling::td/a[img[@title="Edit Filter"]]'))).click()
Upvotes: 1