ruby轨道 – 黄瓜Webrat硒指南
我一直在使用黄瓜和Webrat一段时间.我现在需要开始编写涉及
AJAX交互的行为,所以我正在考虑使用Webrat的Selenium适配器.
任何人都可以指出安装和配置硒webrat黄瓜的简单和更新的分步指南? 我想要将 javascript场景与非javascript场景混合在一起. 解决方法
我在我的项目中使用Sspium与rspec,并从Selenium IDE的自定义格式化器生成代码.
有很多硒的铁轨,但我成功使用Selenium-RC http://seleniumhq.org/download/,所以下载到你的电脑. 这是我的步骤: >解压缩并运行> java -jar selenium-server.jar 现在,您只需将规格导出到您的spec文件夹,我使用spec / features / xxxx_spec.rb,请参阅下面的代码. 非常类似的方法可以在here找到 对于webrat黄瓜,最新的Rspec book将给你所需要的. (他们没有硒黄瓜章节完成) 例 require 'rubygems' gem "rspec","=1.2.6" gem "selenium-client",">=1.2.15" require "selenium/client" require "selenium/rspec/spec_helper" describe "Google Search" do attr_reader :selenium_driver alias :page :selenium_driver before(:all) do @selenium_driver = Selenium::Client::Driver.new :host => "localhost",:port => 4444,:browser => "*firefox",:url => "http://www.google.com",:timeout_in_second => 60 end before(:each) do selenium_driver.start_new_browser_session end # The system capture need to happen BEFORE closing the Selenium session append_after(:each) do @selenium_driver.close_current_browser_session end it "can find Selenium" do page.open "/" page.title.should eql("Google") page.type "q","Selenium seleniumhq" page.click "btnG",:wait_for => :page page.value("q").should eql("Selenium seleniumhq") page.text?("seleniumhq.org").should be_true page.title.should eql("Selenium seleniumhq - Google Search") page.text?("seleniumhq.org").should be_true page.element?("link=Cached").should be_true end end (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |