pageobjects - How to select a option from drop down using select_list comment in capybara page-object -
for html this:
<select class="intl_drop" name="select_locale"> <option value="0">- select 1 -</option> <option value="1">united states - english</option> <option value="2">united states - espaƱol</option> <option value="3">canada - english</option>
when try select option using
select_list(:select_lang, :class => "intl_drop", :index => 1)
i'm getting error message
unable locate element{"method":"xpath","selector":".//select[@class=' intl_drop'][2]"} (selenium::webdriver::error::nosuchelementerror)
it works fine when not use index value.
if understood question problem works:
select_list(:select_lang, :class => "intl_drop")
but not work:
select_list(:select_lang, :class => "intl_drop", :index => 1)
the problem there 1 select list class
intl_drop
.
:index => 1
select the second element. :index => 0
select first one.
Comments
Post a Comment