Skip to main content
2 of 3
added 97 characters in body
PDHide
  • 11.1k
  • 2
  • 16
  • 43

Add an explicit wait after you click your menu and then once the drop-down element is present refer below steps:

https://selenium.dev/docs/site/en/support_packages/working_with_select_elements/

Please refer to the above document:

You can use the select class in ruby to achieve this:

select_element = driver.find_element(id: 'couCode')
select_object = Select(select_element)

To select using text:

select_object.select_by(:text, 'URUGUAY')

Using Value:

select_object.select_by(:value, 'UY')

Using index:

select_object.select_by(:index, 1)

Note:

instead of puts a.text + ', '. Try, puts a.attribute("textContent") +','

PDHide
  • 11.1k
  • 2
  • 16
  • 43