Skip to content

Instantly share code, notes, and snippets.

@p0deje
Created December 10, 2012 05:59
Show Gist options
  • Save p0deje/4248710 to your computer and use it in GitHub Desktop.
Save p0deje/4248710 to your computer and use it in GitHub Desktop.
Selenium wrapped select
require 'selenium-webdriver'
browser = Selenium::WebDriver.for :firefox
browser.get 'http://www.commonfloor.com/'
# first open up drop down
browser.find_element(xpath: '//div[@id="city_chzn"]/a').click
# now click necessary element (note that it won't work with selenium 2.27)
browser.find_element(xpath: '//div[@id="city_chzn"]//li[contains(.,"Bangalore")]').click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment