1
我有一個頁面,其中有許多編輯按鈕。每個按鈕都有相同的id,即enable_edit_content。如何點擊特定的按鈕。如何點擊一個編輯按鈕,當它的定義下重複類似的ID
這是我必須單擊
<div class="sub-controls" id="motion_eligibility_entry-subcontrols">
<button class="btnedit" **id="enable_edit_content"** name="button" type="button"></button>
<input class="btnsave submit_form" id="save_motions_eligibility_entry" name="commit"
type="submit" value="" disabled="disabled">
<button class="btnkill" id="cancel_content" name="button" type="button"
disabled="disabled"></button>
</div>
任何幫助將得到高度讚賞的代碼。 我都試過,但不能讓我的結果: -
1) page.all(:css, '#enable_edit_content').each_with_index do |el, i|
i += 1
if i == 3
el.click
end
end
2)find(:xpath, "//div[@id='motion_eligibility_entry-subcontrols']/button[1]").click
如何手動區分按鈕?或者你總是想要點擊基於索引的按鈕? –