Answer the question
In order to leave comments, you need to log in
How to get child elements excluding their nested elements in Selenium?
Good afternoon.
Code example:
<ul class="comment-list">
<li>First</li>
<li>First
<ul>
<li>SECOND</li
</ul>
</li>
<li>First</li>
<li>First</li>
</ul>
comments_list_parent = driver.find_element_by_css_selector("ul.comment-list")
comments_list = comments_list_parent.find_elements_by_tag_name("li")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question