I'm using selenium/java and have a drop down list for languages. This list contains multiple variations of "English" as you can see in the code below. I want to select just "English". I thought of getting the div tag with span tag containing "English" and not containing "Creoles" (first option) and not containing open parenthesis.
Its omitting the first option but not reading the "(" which is after the span tag but still inside the div tag. How can I write the xpath to read the text inside div which is after the span element?
XPath:
//div[./span[text()='English'] and not(contains(text(),'Creoles')) and not(contains(text(), '('))]
HTML Code: (There are more variations of English but showing only 4 below)
<ul id="oj-listbox-results-contentItemId-67" class="oj-listbox-results" role="listbox">
<li class="oj-listbox-results-depth-0 oj-listbox-result oj-listbox-result-selectable" role="presentation">
<div id="oj-listbox-result-label-6829" class="oj-listbox-result-label" role="option">
Creoles and pidgins,
<span class="oj-listbox-highlighter">English</span>
based
</div>
</li>
<li class="oj-listbox-results-depth-0 oj-listbox-result oj-listbox-result-selectable" role="presentation">
<div id="oj-listbox-result-label-6830" class="oj-listbox-result-label" role="option">
<span class="oj-listbox-highlighter">English</span>
</div>
</li>
<li class="oj-listbox-results-depth-0 oj-listbox-result oj-listbox-result-selectable" role="presentation">
<div id="oj-listbox-result-label-6831" class="oj-listbox-result-label" role="option">
<span class="oj-listbox-highlighter">English</span>
(Australia)
</div>
</li>
<li class="oj-listbox-results-depth-0 oj-listbox-result oj-listbox-result-selectable oj-hover" role="presentation">
<div id="oj-listbox-result-label-6832" class="oj-listbox-result-label" role="option">
<span class="oj-listbox-highlighter">English</span>
(Belize)
</div>
</li>
</ul>