我想选择多个选项。
然后我想验证它是否被选中?
这是我的代码:
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