Surprisingly, I couldn't find a first step guide on how to setup Selenium WebDriver working with selenium-webdriver gem through google university. I suppose the gem needs to know where I store all those jar files to get started. How can I configure this?
You can use Selenium WebDriver APIs to devise test code using Selenium-supported languages like Ruby, Java, JavaScript, C#, and Python. Selenium and Ruby can be used together, and one of the best ways to do it is through using a gem called selenium-webdriver.
First you have to install the gem selenium-webdriver:
gem install selenium-webdriver
Then you can 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
You can find more info:
about webdriver and ruby (all said above was an attempt to summarize it)
about the Ruby webdriver API
As you can see at a glance, the Webdriver API by itself has a different "style" of normal selenium-ruby programs... If you want to use webdriver and still continue to program with the Selenium-API, you should probably chech the Selenium2.0 Remote Server, as it seems that it will use Webdriver in a transparent way, while still mantaining the same known Selenium ruby Api
If I'm wrong with some part of the info, please correct me and we will all together make it clearer :)
PD: Best found info about relationship between Selenium and Webdriver was this blog post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With