【问题标题】:How to click element in Form using Robot Framework如何使用机器人框架单击表单中的元素
【发布时间】:2019-12-03 07:13:24
【问题描述】:

我尝试单击表单中的元素,但机器人不喜欢我提供的元素。 我尝试了 3 种方法,但仍然找不到定位器

 Wait Until Element Is Visible  &{FinishCall}[endCall]  timeout=60s
 Click Element   &{FinishCall}[endCall]

 Submit Form   &{FinishCall}[endCall]

 Execute Javascript   document.getElementById("j_id0:currentCallLogForm:currentCallLogPB:j_id7:j_id9").addEventListener('click', function (){console.log('execute on click')});

元素在 iframe 下的示例 HTML

<input class="btn" id="j_id0:currentCallLogForm:currentCallLogPB:j_id7:j_id9" name="j_id0:currentCallLogForm:currentCallLogPB:j_id7:j_id9" onclick=";A4J.AJAX.Submit('j_id0:currentCallLogForm',event,{'similarityGroupingId':'j_id0:currentCallLogForm:currentCallLogPB:j_id7:j_id9','oncomplete':function(request,event,data){goToCustPage();},'parameters':{'j_id0:currentCallLogForm:currentCallLogPB:j_id7:j_id9':'j_id0:currentCallLogForm:currentCallLogPB:j_id7:j_id9'} ,'status':'sfStatus'} );return false;" value="Finish Not On Call" type="button">

请任何人帮助我。

【问题讨论】:

  • 在对元素进行操作之前是否选择了 iframe
  • 谢谢你现在可以通过先选择 iframe 来正常工作。
  • 先选择iframe然后点击form再点击form中的元素
  • @Dev 您应该将其作为答案发布,或者要求 OP 将工作代码作为答案发布。

标签: robotframework


【解决方案1】:

您操作的元素很可能在 iframe 内,检查页面上的 iframe 并首先选择它 - 使用以下关键字

Select Frame    name or id of iframe
Click Element    element locator or name or id

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-19
    • 2020-05-23
    • 1970-01-01
    • 2023-04-02
    • 2018-09-20
    • 2017-07-29
    • 2018-11-10
    • 2022-10-25
    相关资源
    最近更新 更多