【问题标题】:RobotFramework+selenium cannot click the img buttonRobot Framework+selenium 无法点击图片按钮
【发布时间】:2016-02-04 19:05:10
【问题描述】:

来自 robotsFramework 的测试用例:

        Wait Until Element Is Visible    //input[@value='Data Solutions']
        Wait For Condition    return window.document.querySelector('[value="Data
    Solutions"]').style.visibility != "visible"
        Click Button    //input[@value='Data Solutions']
        Click Link    css=input[value='Data Solutions'] + i
        Wait Until Element Is Enabled     ${ticketServiceSelect}    #next text input field should be enabled

源 html 页面代码:

<div class="btn-group ng-pristine ng-untouched ng-valid" bs-radio-group="" data-toggle="buttons">
<label class="btn service-icon ng-binding ng-scope" btn-radio="'Data Solutions'" ng-repeat="service in serviceGroups.itsmServiceGroups" style="">
<input class="ng-pristine ng-untouched ng-valid" type="radio" value="Data Solutions" bs-radio="" ng-model="ticket.serviceGroup" name="75">
<i class="dna-icon dna-icon-data-solutions"></i>
Data Solutions
</label>
</div>

为什么 selenium 只关注元素而不按下按钮?

【问题讨论】:

  • 为什么你认为它没有按下按钮?你有错误吗?您是否遇到意外行为?关键字是否表示点击但没有任何反应?

标签: python selenium automation robotframework


【解决方案1】:

RadioButton 不是 Button。请改用Click ElementSelect Radio Button

【讨论】:

  • 我也在尝试这个解决方法:Execute Javascript window.document.querySelector('[value="Data Solutions"]').click() 对我来说很好。谢谢!
猜你喜欢
  • 1970-01-01
  • 2020-05-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-29
  • 1970-01-01
  • 2015-04-25
相关资源
最近更新 更多