duanbicheng3345 2017-05-08 10:58
浏览 9

无线电控制在Codeception测试中不可见

My HTML looks like:

<label class="btn-radio ">
   <input type="radio" value="1" name="pens" class="input_normal">                  
   <span></span>Yes
</label>
...

In my codeception test I try to set radio control:

$I->selectOption("//*[@name=pens]/ancestor::label", "1");

but it fails with error:

"Couldn't select option "//*[@name='pens' and @value='1']/ancestor::label","1": ElementNotVisibleException: element not visible".

When I remove the wrapping tags then it works, but UI is ruined. Has anyone encountered this problem before?

</div>
  • 写回答

1条回答 默认 最新

  • doupi1532 2017-05-08 11:46
    关注

    mcklayin gave the correct link to the solution in his comment. Here is my solution (for others to follow when needed). I had to replace selectOption() with click():

    $pensionRequestField = "form#loan_application>div.form_fieldset>section>div#step1>div.row>div.col-19-24>fieldset#pension_registry>label#pension_option1";
    $I->click(self::$pensionRequestField);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题