I'm trying to select a value from my select field:
<select class="form-control select required chosen-select" name="shopping_cart[kind]" id="shopping_cart_kind" style="display: none;">
<option value="">Selecione</option>
<option value="pdc">PDC</option>
<option value="normal">Cotação Normal</option>
<option value="emergency">Cotação Emergencial</option>
<option value="contract">Cotação para Contrato</option>
<option value="price_research">Pesquisa de Preço</option>
<option value="legal_purchase">Compra Judicial</option>
<option value="bidding_exemption">Dispensa de Licitação</option>
<option value="scheduled_delivery">Cotação para entrega programada</option></select>
In my code I'm trying to set the second option:
@type = @browser.select_list(id: "shopping_cart_kind")
@type.select 'PDC'
And I have received this error:
timed out after 30 seconds, waiting for {:id=>"shopping_cart_kind", :tag_name=>"select"} to become present (Watir::Wait::TimeoutError)
I've tried the following alternatives and they did not work:
Click element via javascript:
@browser.execute_script( "return arguments[0].click();", browser.link(:id => 'shopping_cart_kind')
Select by index:
@browser.select_list(id: "shopping_cart_kind", index: 1).select ("PDC") @browser.select_list(id: "shopping_cart_kind").option[1].select
Nothing worked!
Can you please try this code and let me know whether it works?