Selenium Training in Chennai
The Ruby bindings for Selenium/WebDriver are available as the selenium-webdriver gem. The web page explains how to install the selenium-webdriver gem. On Mac OSX and linux you may need to prefix the rest of the command with the sudo command if the installation fails because of security restrictions on your computer.
There are many other Selenium gems out there, but this is the only official, maintained gem. If you're looking for a Selenium Training in Chennai slightly higher level API built on the same technology, you may want to check out watir-webdriver or capybara.
The bindings support Ruby 1.9.2 through 2.1.
API docs
Changelog
The gem also includes the older selenium-client gem for use with Selenium training. When reading the docs, keep in mind that these two namespaces refer to different APIs:
Selenium::WebDriver - the WebDriver API
Selenium::Client - Selenium RC API (previously released as the selenium-client gem)
The WebDriver API is the successor to the Selenium RC API. For people who don't have a significant investment in the legacy API, we recommend starting directly with Selenium::WebDriver, and focusing on the two main classes, Selenium::WebDriver::Driver and Selenium::WebDriver::Element. This is the entry point to the whole WebDriver API.
For people who already have tests written against the Selenium RC API, it's possible to use WebDriver-backed Selenium to ease the migration. The rest of this document deals with Selenium::WebDriver exclusively.
If you're interested in developing the Ruby bindings for Selenium, see the Best Selenium training institutes in Chennai
API Example
The bindings provide a slightly rubified version of the WebDriver API:
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit
Driver examples:
# execute arbitrary javascript
puts driver.execute_script("return window.location.pathname")
# pass elements between Ruby and JavaScript
element = driver.execute_script("return document.body")
driver.execute_script("return arguments[0].tagName", element) #=> "BODY"
# wait for a specific element to show up
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { driver.find_element(:id => "foo") }
# switch to a frame
driver.switch_to.frame "some-frame" # name or id
driver.switch_to.frame driver.find_element(:id, 'some-frame') # frame element
# switch back to the main document
driver.switch_to.default_content
# repositionning and resizing browser window:
driver.manage.window.move_to(300, 400)
driver.manage.window.resize_to(500, 800)
driver.manage.window.maximize
Element examples:
# get an attribute
class_name = element.attribute("class")
# is the element visible on the page?
element.displayed?
# click the element
element.click
# get the element location
element.location
# scroll the element into view, then return its location
element.location_once_scrolled_into_view
# get the width and height of an element
element.size
# press space on an element - see Selenium::WebDriver::Keys for possible values
element.send_keys :space
# get the text of an element
element.text
Advanced user interactions (see ActionBuilder):
driver.action.key_down(:shift).
click(element).
double_click(second_element).
key_up(:shift).
drag_and_drop(element, third_element).
perform
IE
Make sure that Internet Options → Security has the same Protected Mode setting (on or off, it doesn't matter as long as it is the same value) for all zones.
Chrome
Command line switches
For a list of switches, see this Selenium training in Chennai
There are many other Selenium gems out there, but this is the only official, maintained gem. If you're looking for a Selenium Training in Chennai slightly higher level API built on the same technology, you may want to check out watir-webdriver or capybara.
The bindings support Ruby 1.9.2 through 2.1.
API docs
Changelog
The gem also includes the older selenium-client gem for use with Selenium training. When reading the docs, keep in mind that these two namespaces refer to different APIs:
Selenium::WebDriver - the WebDriver API
Selenium::Client - Selenium RC API (previously released as the selenium-client gem)
The WebDriver API is the successor to the Selenium RC API. For people who don't have a significant investment in the legacy API, we recommend starting directly with Selenium::WebDriver, and focusing on the two main classes, Selenium::WebDriver::Driver and Selenium::WebDriver::Element. This is the entry point to the whole WebDriver API.
For people who already have tests written against the Selenium RC API, it's possible to use WebDriver-backed Selenium to ease the migration. The rest of this document deals with Selenium::WebDriver exclusively.
If you're interested in developing the Ruby bindings for Selenium, see the Best Selenium training institutes in Chennai
API Example
The bindings provide a slightly rubified version of the WebDriver API:
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit
Driver examples:
# execute arbitrary javascript
puts driver.execute_script("return window.location.pathname")
# pass elements between Ruby and JavaScript
element = driver.execute_script("return document.body")
driver.execute_script("return arguments[0].tagName", element) #=> "BODY"
# wait for a specific element to show up
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { driver.find_element(:id => "foo") }
# switch to a frame
driver.switch_to.frame "some-frame" # name or id
driver.switch_to.frame driver.find_element(:id, 'some-frame') # frame element
# switch back to the main document
driver.switch_to.default_content
# repositionning and resizing browser window:
driver.manage.window.move_to(300, 400)
driver.manage.window.resize_to(500, 800)
driver.manage.window.maximize
Element examples:
# get an attribute
class_name = element.attribute("class")
# is the element visible on the page?
element.displayed?
# click the element
element.click
# get the element location
element.location
# scroll the element into view, then return its location
element.location_once_scrolled_into_view
# get the width and height of an element
element.size
# press space on an element - see Selenium::WebDriver::Keys for possible values
element.send_keys :space
# get the text of an element
element.text
Advanced user interactions (see ActionBuilder):
driver.action.key_down(:shift).
click(element).
double_click(second_element).
key_up(:shift).
drag_and_drop(element, third_element).
perform
IE
Make sure that Internet Options → Security has the same Protected Mode setting (on or off, it doesn't matter as long as it is the same value) for all zones.
Chrome
Command line switches
For a list of switches, see this Selenium training in Chennai
Advertise on APSense
This advertising space is available.
Post Your Ad Here
Post Your Ad Here
Comments