Handling Select Box using selenium-webdriver rubygem

Handling Select Box using selenium-webdriver rubygem

Assuming that select field –> name is ‘num’ and it has options –>  “10 results” and “20 results”

User need to select “20 results”  from selct box

Code:

a=driver.find_element(:name,’num’)

options=a.find_elements(:tag_name=>”option”)
options.each do |g|
if g.text == “20 results”
g.click
break
end
end

Advertisements

3 thoughts on “Handling Select Box using selenium-webdriver rubygem

  1. manasadesina says:

    Hi raveendran,

    This is manasa working on selenium c# with web driver.Can u provide sample code for “How to retrieve data from excel sheet”.
    Please help me.
    Thanks in advance.
    Regards,
    D.Manasa

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s