Tag: finder

在Selenium 2.9中选择Image

我正在尝试使用RSpec来尝试自动化测试维护后的周末,我正在这里实习。 我正在使用Selenium WebDriver 2.9.0获取一个特定的代码,然后添加个性化代码。 我目前所坚持的是尝试让WebDriver点击一个图像,然后导航到正确的HTML,但我目前无法这样做。 这是我到目前为止所拥有的…… it “can go to Ultratime” do @ie_driver.find_element(:link, “My Resources”).click wait.until { @ie_driver.execute_script(“return document.readyState;”) == “complete” } sleep 3 wait.until { @ie_driver.find_element(:link_text => “Login”).displayed?} #test above line puts “found Ultratime” #this just finds the “Logout” button and clicks it @ie_driver.find_element(:name, “ee”).click end 这是与我试图浏览的网站的“按钮”相关的HTML代码: Login 任何帮助将不胜感激!

对于模型和集合,覆盖ActiveRecord查找的最简洁方法是什么?

我有库代码覆盖了Ar的find方法。 我还为所有Association类包含了模块,因此MyModel.find和@ parent.my_models.find都可以工作并应用正确的范围。 我的代码基于will_paginate: a = ActiveRecord::Associations returning([ a::AssociationCollection ]) { |classes| # detect http://dev.rubyonrails.org/changeset/9230 unless a::HasManyThroughAssociation.superclass == a::HasManyAssociation classes << a::HasManyThroughAssociation end }.each do |klass| klass.send :include, Finder::ClassMethods klass.class_eval { alias_method_chain :method_missing, :paginate } end 我的问题是,我只想覆盖某些模型的查找程序。 目前,我需要扩展所有模型共享的所有关联集合类。 我知道我可以通过传递一个模块来扩展每个模型的关联: has_many :things, :extend => SomeCustomMethods 但我的库基本上是ActiveRecord插件,所以我想要一个适用于模型和范围集合的可插入finder扩展的简洁约定,而不会影响应用程序中的所有模型。