我有四个单选按钮:
<div class="x1-radio">
<input id = " " type="radio" name=" " value="12345">
<span class=" ">Radio 1 - Good Luck</span>
<div class="x1-radio">
<input id = " " type="radio" name=" " value="12345">
<span class=" ">Radio 2 - Good Luck</span>
<div class="x1-radio">
<input id = " " type="radio" name=" " value="12346">
<span class=" ">Radio 3 - Good Luck</span>
<div class="x1-radio">
<input id = " " type="radio" name=" " value="12347">
<span class=" ">Radio 4 - Good Luck</span>
由于这些是单选按钮,我可以一次选择一个。我知道如何使用 xpath 选择单选按钮:
nPath = '//*[@class="x1-radio"]//span[text() = "Radio 1 - Good Luck"]'
browser.element(:xpath, nPath).fire_event "onclick"
此时选择了一个按钮。我想知道的是如何将“输入”标签中的属性一一显示到屏幕上。
我在这里找到了一些信息: How can I get value of element custom attribute with Watir 但做不到。