简体   繁体   English

如何使用Robot Framework选择此单选按钮?

[英]How to select this radio button using Robot Framework?

Wondering whether any Robot Framework Selenium2 rock star can help me figure out how to select this radio button: 想知道是否有任何Robot Framework Selenium2摇滚明星可以帮助我弄清楚如何选择此单选按钮:

<input type="radio"
id="CLIENTINFO.pIHaveDL_RAD-1.widget_2C56E5B6AA7C8538090416DEE7DE5A73000"
class="radiobutton webform-aria" aria-invalid="false" aria-required="true"
title="" value="on" style=" position:relative; left:-4px; top:-4px;
overflow:visible;" checked="true">

The RF Selenium2Library "Select Radio Button" keyword only allows me to provide a "group name" as locator. RF Selenium2Library“选择单选按钮”关键字仅允许我提供“组名”作为定位符。 I have been successful using that on other radio buttons that actually have a group name in the markup. 我已经成功地在标记中实际上具有组名的其他单选按钮上使用了它。 The radio button above doesn't have one. 上面的单选按钮没有一个。

I had considered trying the Selenium2 "Click Element" keyword and using Id as a locator, but the Id (in the markup above) is dynamic (ie different with every login), and I don't think RF can do partial Id can it? 我曾考虑过尝试使用Selenium2“点击元素”关键字,并使用Id作为定位符,但是Id(在上面的标记中)是动态的(即每次登录都不同),而且我认为RF不能做到部分Id可以? (edit: I just figured out that it does support this. I've used partial Id inside xpath) (编辑:我刚刚发现它确实支持此操作。我在xpath中使用了部分ID)

The only other option I could think of is to use the "Execute JavaScript" keyword with document.QuerySelector() and a partial Id... but I'm not very good with JavaScript so I'm not confident that there is a click method that will work well cross-browser. 我唯一想到的另一种选择是将“ Execute JavaScript”关键字与document.QuerySelector()和部分ID结合使用...但是我对JavaScript不太满意,因此我不确定单击是否会发生跨浏览器效果很好的方法。

I'd appreciate any insight here. 我希望在这里有任何见识。

实际上,我只是发现这可行:单击Element xpath = // * [包含(@id,'CLIENTINFO.pIHaveDL_RAD-1.widget')]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM