How can I select an option from a dropdown using Ruby Selenium Webdriver?

0 votes
How can I select an option from a dropdown using Ruby Selenium Webdriver?
Aug 26 in Selenium by Swasti
17 views

1 answer to this question.

0 votes

Hey Swasti, you can try following lines of code to perform selection of an option from a dropdown:

driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://facebook.com"

options = select_list.find_elements(:tag_name => "option")
options.each do |opt|
  if opt.text == "March"
    opt.click
    break
  end
end
answered Aug 26 by Anvi
• 12,860 points

Related Questions In Selenium

0 votes
1 answer

How can I select date from a datepicker div using Selenium Webdriver?

Hey Jeevika, you can use following automation ...READ MORE

answered Jul 15 in Selenium by Abha
• 23,030 points
60 views
0 votes
1 answer
0 votes
1 answer

Select an item from a dropdown list using Selenium WebDriver

Use this then it will work - new ...READ MORE

answered Apr 9, 2018 in Selenium by Vardy
• 2,250 points
2,045 views
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
570 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
897 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
561 views
0 votes
1 answer