I am using cucumber with capybara to automate a web application. I have to select a value from the drop-down list, but many times I get an error, for example; "invalid String argument type (expected array) (TypeError)"
I tried: 1.
second_option_xpath = ".//*[@id='selecttype']/option[2]"
second_option = find(:xpath, second_option_xpath).text
select(second_option, :from => 'selecttype')
2.
select "Selenium Core", :from => 'selecttype'
3.
page.find_and_select_option("selecttype", 2)
4.
select( "selecttype", {"Selenium Core" => 2})
PAGE SOURCE SOMETHING LIKE:
<select id="selecttype">
<option value="Selenium IDE">Selenium IDE</option>
<option value="Selenium Code">Selenium Core</option>
<option value="Selenium RC">Selenium RC</option>
<option value="Selenium Grid">Selenium Grid</option>
</select>"
Please suggest where I am doing wrong?
thank
Atin source
share