I am writing automation script for a Angular application. I am finding it very difficult is getting Xpath for the elements, i am stuck at getting the xpath for a toaster message that comes on the screen for a few seconds. Below is the code for it.
<span id="j_id0:j_id78" class="ng-scope">
<form class="ng-pristine ng-valid ng-submitted" style="">
<div class="slds-col slds-size--12-of-12 slds-p-top--small">
<notifications class="ng-isolate-scope" duration="5000" messages="getMessages('success')" type="toast">
<!-- ngRepeat: message in messages -->
<div class="ng-scope" ng-repeat="message in messages" style="">
<div class="slds-box slds-notify__content slds-grid ng-hide slds-theme--success" ng-show="type == 'message'" ng-class="{Error: 'slds-theme--error', Warning: 'slds-theme--warning', Success: 'slds-theme--success', Info: 'slds-theme--info'}[message.severity]">
<svg class="slds-icon slds-icon--small slds-m-right--small slds-col slds-no-flex" aria-hidden="true">
<div class="slds-col slds-align-middle">
<p class="ng-binding" ng-bind-html="message.description">Download operation successful</p>
</div>
</div>
<div class="slds-notify_container" ng-show="type == 'toast' || type == 'alert'">
<div class="slds-notify slds-notify--toast slds-theme--success" role="alert" ng-class="{Error: 'slds-theme--error', Warning: 'slds-theme--warning', Success: 'slds-theme--success', Info: 'slds-theme--info'}[message.severity]">
<button class="slds-button slds-button--icon-inverse slds-notify__close" name="close" title="Close" type="button" ng-click="closeAlert($index)">
<div class="slds-notify__content slds-grid">
<svg class="slds-icon slds-icon--small slds-m-right--small slds-col slds-no-flex" aria-hidden="true">
<p class="ng-binding ng-hide" ng-show="type == 'alert'" ng-bind-html="message.description">Download operation successful</p>
<div class="slds-col slds-align-right" ng-show="type == 'toast'">
<p class="ng-binding" ng-bind-html="message.description">Download operation successful</p>
</div>
</div>
</div>
</div>
</div>
<!-- end ngRepeat: message in messages -->
</notifications>
<notifications class="ng-isolate-scope" messages="getMessages('info')" type="toast">
<!-- ngRepeat: message in messages -->
</notifications>
<notifications class="ng-isolate-scope" messages="getMessages()" type="toast">
<!-- ngRepeat: message in messages -->
</notifications>
</div>
I tried this - //div/p[text() = 'Download operation successful'] but element is not located.
Could you please tell me what is the correct xpath? and also if you could guide me to some website where I can read more about automation for Angular application I will be grateful.
Thank you. Divya