从下拉列表(自定义)中选择一个值而不是常规下拉列表,它有很多下拉值
我可以用代码选择第一个值
find('.selected', :text=>arg1,exact: false).click
但无法选择剩余的值,因为文本有很多填充空间!如何应对这种情况
最佳答案
我不确定下拉菜单是什么样的,但您可能会做的一件事是收集所有选项:
dropdown = session.find(:css, '#ElementId') #customize as needed
options = dropdown.all(:css, "option").collect {|o| o.text}
然后使用索引从下拉列表中选择:
session.select options[3], from: 'ElementId'
关于css - 寄存器 0x104567911,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22556621/