How can I select multiple options from a select list in ruby using selenium webdriver

143 Views Asked by At

I want to select multiple options.

Then I want to verify it whether it is selected or not?

Here is my code:

require 'selenium-webdriver'

class Ques7
  def test_multiple_select
    driver = Selenium::WebDriver.for :firefox
    driver.get(url)
    driver.find_element(:xpath, './/*[@id="select_1"]').click
    puts driver.find_element(:xpath, './/*[@id="select_1"]').selected?
    driver.find_element(:xpath, './/*[@id="select_2"]').click
    driver.find_element(:xpath, './/*[@id="select_4"]').click
    puts driver.find_element(:xpath =>'.//*[@id="select_1"]',
    :xpath => './/*[@id="select_2"]',:xpath => './/*[@id="select_4"]').selected?
  end
end

obj = Ques7.new
obj.test_multiple_select
0

There are 0 best solutions below