Reputation: 1
<div class="class-one">
<div class="class-two">
sample text
<div class="class-three">
<a href="https://google.com" target="" class="button button--outline button--purple " id="" title="search"><i class="fal fa-fw fa-file-word"></i><span class="button__title">search</span></a>
</div>
</div>
</div>
When i do driver.find_elements_by_css_selector('div.class-two')
it prints sample text
and search
too, how can i get only sample text using selenium in python?
Upvotes: 0
Views: 141
Reputation: 2804
You need only write "text" in end.
driver.find_element_by_css_selector('div.class-two').text
Upvotes: 1