简体   繁体   中英

Filtering elements selected by selenium through .find_elements_by_class_name using python

I have a program that selects these yellow elements by their common class name.

I'm trying to further filter these selections by the column/row they're a part of, but I'm not sure how to filter my selenium selections further. This is a copy of the HTML for the elements I'm selecting.

Is it possible for me to first specify the XPATH of the date and then select the class elements within that date?

This is my current code to select these yellow elements.

except NoSuchElementException:
        items = driver.find_elements_by_class_name("status3")

Let's say we need to get child elements of your date who has an xpath

date=driver.find_element_by_xpath("xpath")

We could add //div[@class='status3'] in it's xpath as well to get all items or we do the following.

items=date.find_elements_by_class_name("status3")

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