by.cssContainingText in Python/Selenium
<p>In Protractor there is a handy <a href="http://www.protractortest.org/#/api?view=ProtractorBy.prototype.cssContainingText" rel="nofollow noreferrer"><code>by.cssContainingText</code> location strategy</a> that would basically do two things - locate an element (or elements) by a CSS selector and check the element's text to contain a desired string. Sample:</p>

<pre><code>var elm = element(by.cssContainingText('#myid .myclass', 'Some Text'));
expect(elm.isDisplayed()).toBe(true);
</code></pre>

<p><em>How can this be done in Python/Selenium?</em> </p>

<p>Note that I am aware of the XPath way of checking the text. I'm interested specifically in using CSS selectors and checking the text of an element. </p>