1
機器人框架沒有通過xpath標識元素。機器人框架沒有通過xpath正確找到元素
以下是
<div id="sticky-actions-sticky-wrapper" class="sticky-wrapper" style="height: 100px;"><section class="content-header" id="sticky-actions" style="">
<h1>Curriculum</h1>
<div class="breadcrumb save-message hidden">
<label class="text-success">
<i class="flaticon flaticon-circle-check"></i>
Saved <span>a few seconds ago</span>
</label>
</div>
<div class="row p-t-15">
<div class="col-xs-12">
<button type="button" class="btn btn-primary add-task-btn" disabled="">Create New Task</button>
<div class="btn-group m-r-15">
<button type="button" class="btn btn-primary dropdown-toggle add-statement-btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="">
Create <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a tabindex="0" class="add-curriculum-btn">Curriculum</a></li>
<li><a tabindex="0" class="add-learning-area-btn hidden">Learning Area</a></li>
<li><a tabindex="0" class="add-topic-btn hidden">Topic</a></li>
<li><a tabindex="0" class="add-outcome-btn hidden">Outcome</a></li>
</ul>
</div>
<button type="button" class="btn btn-circle btn-xs blue link-statements-btn" disabled="" data-toggle="tooltip" data-placement="top" title="" data-original-title="Link selected statements">
<i class="fa fa-link"></i>
</button>
</div>
</div>
</section></div>
的Xpath我曾經發現代碼 「創建」 按鈕:
的XPath = // * [@ ID = 「粘行動粘性,包裝」 ]/div [2]/div/div/button
xpath = // * [@ id =「sticky-actions」]/div [2]/div/div/button [.// text()= '創建']
機器人框架步驟:
click element xpath=//*[@id="sticky-actions-sticky-wrapper"]/div[2]/div/div/button
錯誤: -
ValueError異常:元素定位器「的xpath = // * [@ ID = 「粘性動作粘性-包裝」] /格[2 ]/div/div/button'與任何元素都不匹配。
您可以檢查是否有任何框架,作爲定位器看起來也不錯,你可以把一些等待功能來找到這個元素:如果添加它應該工作 –