Finding Elements With Css Selenium

Finding Elements With Css Selenium

CSS Selectors are way to identify elements on the page.

Selenium can use CSS selectors to find elements, which then you can interact with (i.e. click, send keys, etc.).

For example, in Ruby:

require 'selenium-webdriver'

driver = Selenium::WebDriver.for(:firefox)


input_element = driver.find_element(:css => '#the_forms_id input[type=text]')



To learn more about using CSS Selectors with Selenium, check out our Selenium Bootcamp!