Search code examples
seleniumselenium-webdriverxpathcustom-tags

Can I create XPath with custom tags used?


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>

Solution

  • 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