clicking dropDownMenu item - selenium ruby
I believe you're asking the same question as this guy... as the selenium-webdriver treats a lot of elements the same way.
How do I set an option as selected using Selenium WebDriver (selenium 2.0) client in ruby
dropDownMenu = @driver.find_element(:class, 'dropDownMenu')option = Selenium::WebDriver::Support::Select.new(dropDownMenu)option.select_by(:text, 'Billing to Shipping')option.select_by(:value, 'Billing to Shipping')
this should do it for you...
@driver.find_element(:id, "copyAddress").find_element(:css,"option[value='1']").click
where value number is the value of the option corresponding to "Billing to Shipping"
Here's a better option that I found:
#Select the dropdown button dropdown_list = driver.find_element(:id, 'copyAddress')#Get all the options from the dropdownoptions = dropdown_list.find_elements(tag_name: 'option')#Find the dropdown value by textoptions.each { |option| option.click if option.text == 'Shipping to Billing' }