我找不到用于选择parentArray.forEach(function(entry) {
entry.childArray.forEach(function(childrenEntry, index) {
console.log(`${entry.index} ${index} ${childrenEntry}`);
});
});
按钮的命令语法。
例如按钮:NL
我在互联网上进行了搜索,但找不到很好的例子。 我希望你能帮助我。我是新来的,所以我真的需要一些帮助。
这是一段HTML:
radio
答案 0 :(得分:2)
这不是唯一的选择,但是我发现xpath是机器人框架中最简单的方法。
为了单击您要查找的输入,可以使用xpath。在文档中,类似Get Element的方法采用输入参数即定位器。文档中有一整节关于定位器的内容。您可以使用jquery,text,xpath ...
Xpath是一种在html文档中选择内容的方法。使用双斜杠(//)表示您正在文档中的所有位置。然后选择父级(此处为TR),然后可以描述您要查找的元素的路径
Click Element xpath://tr/td/label/input
尝试阅读这些页面:
Xpath:https://en.m.wikipedia.org/wiki/XPath
Selenium2Library _部分定位符:http://robotframework.org/Selenium2Library/Selenium2Library.html#Locating%20elements
答案 1 :(得分:2)
我认为元素ID和名称不是动态的。要单击单选按钮。
Wait Until Element Is Visible xpath://td//label[@for='custom_field_1_value_0']//input[@name='custom_field_1'][@type='radio'] 10
Click Element xpath://td//label[@for='custom_field_1_value_0']//input[@name='custom_field_1'][@type='radio']
或者,如果您喜欢引用custom_Schermtaal
,请尝试以下代码。
Wait Until Element Is Visible xpath://th[contains(.,'custom_Schermtaal')]/following::td[1]//input 10
Click Element xpath://th[contains(.,'custom_Schermtaal')]/following::td[1]//input
希望这会有所帮助。