I have this common situation where I want to locate an element by it's visible text, but the text is next to an i tag used for icons (not sure if this is valid HTML or not). It's the way a certain button component is set up that's used all over the site under test.
Here's some example HTML
<a href="#/provider_data_files/create" ng-click="providerDataFileCtrl.showAddProviderDataFileModal()" class="btn btn-primary pull-right">
<i class="fa fa-plus btn-icon"></i>
Add Provider Data File
</a>
For the moment, ignore all the other ways to locate this link, as my use case requires using the visible text. How can I locate this element by the visible text? The xpath:
//*[contains(text(), 'Add Provider Data File')]
fails, I assume because of the weird structure.