当一个项目被添加到购物车时,它会在一个 div 中有五个 select_lists,我需要获得使用页面对象 gem 的选定选项。
代码如下所示:
<div id='item_basket_235423423'>
<select_list id = 'fruit_23423423'>...</select_list>
<select_list id = 'fruit_24533424'>...</select_list>
<select_list id = 'fruit_26352321'>...</select_list>
<select_list id = 'fruit_23462425'>...</select_list>
<select_list id = 'fruit_23346342'>...</select_list>
</div>
<div id='item_basket_23423464'>
<select_list id = 'veg_684341'>...</select_list>
<select_list id = 'veg_65181351'>...</select_list>
<select_list id = 'veg_86516843'>...</select_list>
<select_list id = 'veg_21676919'>...</select_list>
<select_list id = 'veg_9831568'>...</select_list>
</div>
这会找到所有的 select_lists:
select_lists(:selected_basket_fruits, :id => /fruit/)
select_lists(:selected_basket_vegetables, :id => /veg/)
从这里我不确定如何为每个选项找到选定的选项。我正在使用 ruby/cucumber/watir-webdriver 和 page-object gem。
一如既往地感谢您的帮助。