Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Selenium by (7k points)

How should I setup Selenium WebDriver working with selenium-webdriver gem through google university.

1 Answer

0 votes
by (31.9k points)
edited by

First install the gem selenium-webdriver:

gem install selenium-webdriver
 

Then start your ruby program:

#You need to require the gem "selenium-driver"
require "selenium-webdriver"
#... see webdriver ruby api docs here: http://selenium.googlecode.com/svn/trunk/docs/api/rb/_index.html
#... Most usefull classes are Driver and Element, check them out for a good start
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://www.google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit

 Want to learn Selenium, checkout our Selenium training.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...