← Back to Discord Forum

Finding and looping over all elements with Class of .second that are inside a div with Class .first

Say I have a div with a class of .first. I am aware I could do something like page.wait_for_selector(".first") then I would get that div. But how would I actually loop over only all of the children that have a classname of .second? And then i would have to get elements inside of that .second element that have the classname of .third. Then I would want to press this item, since it is a button. (I have to find data inside of the other child elements inside of .second to decide weather or not to press the button and I am using python)

This thread is trying to answer question "How can I loop over elements with a class of .second that are children of a div with a class of .first, and then access elements with a class of .third inside .second to decide whether to press a button using Python?"

1 reply

An HTML code example would be beneficial to understand the question

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.