gem install selenium-webdriver
例 6.2. ruby testcase
require "selenium" require "test/unit" class NewTest < Test::Unit::TestCase def setup @verification_errors = [] if $selenium @selenium = $selenium else @selenium = Selenium::SeleniumDriver.new("192.168.1.3", 5555, "*firefox", "http://www.google.com/", 10000); @selenium.start end @selenium.set_context("test_new") end def teardown @selenium.stop unless $selenium assert_equal [], @verification_errors end def test_new @selenium.open "/" @selenium.type "q", "selenium rc" @selenium.click "btnG" @selenium.wait_for_page_to_load "30000" assert @selenium.is_text_present("Results * for selenium rc") end end
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。