I need to find a certain text in a nested div that has no class or id.
This is a structure of the html.
<div class="active_row">
<div class="outcomes">
<div class="event_outcome" onclick="doSomething">
<div>Target Text</div>
</div>
</div>
</div>
I tried accessing the text directly using the example I got from here.
driver.find_elements_by_xpath("//div[contains(., 'Target Text')]")
This returns a list of elements that contain the target text but nothing happens when I run the click method on them.
What's the best way to set this query to find the text and then click on the div with event_outcome
class?