简体   繁体   中英

How to click on specific element in table?

How to click on specific element in table by first filtering by row and then column and then click on whatever matches those two conditions.

I tried using:

WebDriverWait(driver, 5, ignored_exceptions=NoSuchElementException).until(EC.element_to_be_clickable((By.XPATH, f"//div[child::span[text()='{oddsnumber}'] and span[text()='{oddstype}']]"))).click()

but it doesn't work. I'm not sure how to make it so it looks first for row and then look for column and then click on element that matches row and column. Page looks like this在此处输入图像描述

To click on specific element in table ```/following`` can be used:

oddstype = "4.50"
oddsnumber = "1.850"

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='srb-ParticipantLabelCentered_Name ' and contains(., '{oddstype}, 3.0')]/following::span[text() ='{oddsnumber}']"))).click()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM