我正在为Angular应用程序编写自动化脚本。我发现很难获得元素的Xpath,我被困在获取屏幕上几秒钟的烤面包机消息的xpath。下面是它的代码。
<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>
&#13;
我尝试了这个 - // div / p [text()=&#39;下载操作成功&#39;]但找不到元素。
你能告诉我什么是正确的xpath吗?如果你能引导我到一些我可以阅读更多关于Angular应用程序自动化的网站,我将不胜感激。
谢谢。 Divya