mzt*_*two 3 selenium xpath capybara twitter-bootstrap capybara-webkit
I have the following button group that I cannot get Capybara w/ Selenium to select for:
<div class="btn-group hidden-sm" data-toggle-name="user[attributes][0][customization_id]" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" value="17">
Stocky body
</label>
<label class="btn btn-default">
<input type="radio" value="16">
Round body
</label>
</div>
Run Code Online (Sandbox Code Playgroud)
I have tried to following:
click_button 'Stocky body'
find(:xpath, "//input[@value='16']").click
Run Code Online (Sandbox Code Playgroud)
and
find(:xpath, "//input[@type='radio'][@value='16']").click
Run Code Online (Sandbox Code Playgroud)
At this point I've ready over an hour of :xpath and Capybara answers and they all see to be saying that the :xpath code should at least work.
Can anyone shed light on what I'm doing wrong here?
我找到了解决方案,因为输入标签没有关闭我需要使用Capybara并找到标签.
以下代码能够工作:
page.find('label', text: 'Stocky body').click
Run Code Online (Sandbox Code Playgroud)
希望这有助于其他人尝试使用Bootstrap风格的选择器使用Capybara!
归档时间: |
|
查看次数: |
1288 次 |
最近记录: |