簡體   English   中英

沒有屬性的單擊按鈕

[英]splinter click button with no attributes

我正在使用碎片來嘗試單擊沒有屬性的按鈕。 開發人員工具中的html代碼是

<div class="numeric">
     <button>0</button>
     <button>1</button>
     <button>...</button>
     <button>9</button>
</div>

執行一個jQuery。

我的代碼看起來像這樣

browser.find_by_css("numeric").find_by_text("0").first.click()

但是,我得到找不到該數字。 我也嘗試過#numeric。

那不是div類的CSS。 您可以嘗試使用xpath通過以下方式找到它:

browser.find_by_xpath("//div[contains(@class, 'numeric')]")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM