选择带有机器人框架的单选按钮

时间:2017-02-08 08:30:14

标签: python-2.7 radio-button automated-tests robotframework

我正在尝试使用Robotframework(Python2.7,Selenium2Library)选择一个单选按钮。

我有以下代码:

<div id="dt_method_cashondelivery" class="u-border-b-dotted u-space-pt-10                                                       
 u-space-pb-5">
     <input id="p_method_cashondelivery" class="Form-check-toggle"  
 type="radio"title="Cash On Delivery" name="payment[method]"           
 value="cashondelivery"/>
     <label class="Form-radio" for="p_method_cashondelivery">
         <span>Cash On Delivery </span>
     </label>
 </div>

我使用的机器人框架代码是:

Select Radio Button    payment[method]    cashondelivery

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

使用以下关键字

Click Element    jquery=#p_method_cashondelivery

OR

Click Element    css=#p_method_cashondelivery

如果您使用 id 属性定位元素,则在其前面加上'#',如果您使用定位元素,则先于的 ''