簡體   English   中英

我無法使用Robot Framework單擊單選按鈕。(和selenium2Library)

[英]I am not able to click radiobuttons using Robot Framework.(and selenium2Library)

有人可以幫我嗎?

實際上, 單選按鈕始終位於DOM中,但是它們在頁面上基於ADDRESS字段可見,因此,如您在下面看到的,如果分揀交付時區相同,則單選按鈕在頁面上不可見: 這里

但是,如果它們(提取時區和交付時區)不同,則可以看到“ 無線電按鈕” ,如下所示: 這里

現在,在我的腳本中,我嘗試將所有單選按鈕設置為NO,因此在運行腳本時腳本會通過,但實際上單選按鈕保持不變。 結果為PASS,如下所示 這里

運行腳本后的Chrome瀏覽器如下所示: 這里

這是我為等待和單擊單選按鈕編寫的腳本:

`wait until element is enabled  id=exportclearance_1
  page should contain radio button  id=exportclearance_1
  click element  id=exportclearance_1
  click element  id=transitclearance_1
  click element  id=importclearance_1
  click element  id=insurance_1`

這是頁面的HTML:

`<div class="form-group">
<label class="col-sm-4 control-label" for="">
<div class="col-sm-6">
<input id="exportclearance_0" name="export_clearance" value="True" autocomplete="off" type="radio"/>
<label class="control-label control-label-light clearance" for="exportclearance_0">Yes</label>
<input id="exportclearance_1" name="export_clearance" value="False" autocomplete="off" type="radio"/>
<label class="control-label control-label-light clearance" for="exportclearance_1">No</label>
<br/>
</div>
</div>
<div id="exportclearance-textarea" style="display:none">
<div class="row col-sm-6 col-sm-offset-4">
<textarea id="field-exportclearance" class="form-control customs-field" cols="40" name="export_clearance_instructions" placeholder="Instructions for export clearance (E.g. Broker details, Customs number, etc.)" rows="2"/>
</div>
</div>
<div class="form-group">
<div id="transitclearance-textarea" style="display:none">
<div class="form-group">
<div id="importclearance-textarea" style="display:none">
</div>
<div class="form-group">
<div id="id_attachment_formset_parent">
<div class="form-group">
<di

`

JavaScript執行器為我工作,如下所示。

execute javascript document.getElementById('insurance_1').click()

暫無
暫無

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

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