Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
このhtmlコードのボタンをクリックしようとしています
<div class="modal-footer"><button class="btn" data-dismiss="modal">Kapat</button></div>
私はすでにさまざまな組み合わせで検索を試みましたが、成功に最も近いのは次のコードでした:
click_on "Kapat"
問題は、ページに同じボタンのコピーが 3 つあることです。私の質問は次のとおりです。この特定の div を指定する方法はありますか?
ボタンに特定のパスがある場合は、そのパスへのwithinorを使用できますfindが、要素へのそのパスはページ内で一意である必要があります。そうしないと、同じ問題が発生します (ただし、を使用:xpathすると、ここではもう少し柔軟性があります)。
within
find
:xpath
within ".modal-footer" do click_on "Kapat" end within ".another-selector" do click_on "Kapat" end