Can I create XPath with custom tags used?

910 Views Asked by At

In my application custom tags (another framework) are used. I need to create an XPath for a button.

<mosaic-button class="mc-btn" id="btnShowResults btnShowResults " color="secondary" type="button" title="Show results" text="Show results" data-ng-disabled="v1RetrieveService.activeAdvSearchSettings().length < 1 || !isValidForm()" data-ng-click="v1RetrieveService.activeAdvSearchSettings().length < 1 || !isValidForm() || showResults()">
    <button type="button" class="mc-btn__button mc-btn__button--secondary" ng-class="{'mc-btn__button--rounded mc-btn__button--icon-only' : rounded, 'mc-btn__button--icon-only' : justicon}" aria-label="" ng-disabled="disab">
        <!-- ngIf: useIcon -->
        <div class="mc-btn__div ng-binding" ng-class="{'mc-btn__div--icon-only' : rounded, 'mc-btn__div--icon-only' : justicon}">
            <!-- ngIf: showSpinner -->
            Show results
        </div>
    </button>
</mosaic-button>
2

There are 2 best solutions below

0
Prophet On BEST ANSWER

You can use custom tags in the same way as you using standard tags.
So you can use //mosaic-button or //mosaic-button/button xpaths

0
vitaliis On

Not sure what you mean by custom tags. To find this button, I'd use the xpath:

//div[contains(@class,'mc-btn__div ng-binding') and contains(@ng-class, 'mc-btn__div')]