In short and crisp, yes you create xpath with multiple contains() function as follows:
//div[contains(@class, 'measure-tab') and contains(., 'someText')]
This usecase
Given the HTML:
<li class="oxd-main-menu-item-wrapper" data-v-6475d26d="" data-v-636d6b87="">
<a class="oxd-main-menu-item active" href="/web/index.php/leave/viewLeaveModule" data-v-6475d26d="">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 500 500" role="presentation" class="oxd-icon oxd-main-menu-item--icon" data-v-bddebfba="" data-v-6475d26d="">
<g fill="currentColor">
<path ...></path>
</g>
</svg>
<span class="oxd-text oxd-text--span oxd-main-menu-item--name" data-v-7b563373="" data-v-6475d26d="">Leave</span>
</a>
</li>
The desired <a>
element:
<a class="oxd-main-menu-item active" href="/web/index.php/leave/viewLeaveModule" data-v-6475d26d="">
is within it's parent <li>
element:
<li class="oxd-main-menu-item-wrapper" data-v-6475d26d="" data-v-636d6b87="">
To identify the element you can use either of the following locator strategies:
Using cssSelector:
li.oxd-main-menu-item-wrapper > a.oxd-main-menu-item.active
Using cssSelector and contains clause:
li[class*='oxd-main-menu-item-wrapper'] > a[class*='oxd-main-menu-item']
Using xpath:
//li[@class='oxd-main-menu-item-wrapper']/a[@class='oxd-main-menu-item active']
Using xpath and contains():
//li[contains(@class, 'oxd-main-menu-item-wrapper')]/a[contains(@class, 'oxd-main-menu-item active')]