草庐IT

webdriver-helper

全部标签

ruby-on-rails - 将 Rails Form Helpers 与序列化的自定义类一起使用

我试图在单个数据库字段中保存选项的散列。该表单能够将数据保存到数据库,但当我去编辑它时无法再次检索它(例如,除了wp_options字段之外,所有其他字段都已预填充)。classProfile这是我的自定义类:classWP_Optionsattr_accessor:wp_name,:wp_desc,:wp_limitend在我的表单中:true)do|f|%>......在我的Controller中:@profile=Profile.new(:wp_options=>WP_Options.new)在我的数据库列“wp_options”中:---!map:ActiveSupport::

ruby - 我们可以一起使用 selenium-webdriver 和 nokogiri 吗?

我使用Nokogiri如下:require'nokogiri'require'open-uri'#GetaNokogiri::HTML::Documentforthepagewe’reinterestedin...doc=Nokogiri::HTML(open('http://www.google.com/search?q=sparklemotion'))但是我不好,可能是由于公司的防火墙,我得到了错误:C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in`initialize':getaddrinfo:Nosuchhostisknown.(Sock

ruby - 如何在 selenium-webdriver 中获取窗口标题、ID 和名称?

我正在尝试从selenium-webdriver(ruby)实现以下方法get_all_window_idsget_all_window_titlesget_all_window_names我运行了SeleniumIDE并将我的脚本导出到RubyTest::Unit。另存为.rb使用AptanaStudio3打开我的脚本进行编辑初始代码片段如下:require"rubygems"require"selenium-webdriver"require"test/unit"classSwitchToPopup3我不断得到的错误是NoMethodError:undefinedmethod`ge

ruby-on-rails - 无法连接到 chromedriver http://127.0.0.1:9515 (Selenium::WebDriver::Error::WebDriverError)

我已经从http://chromedriver.storage.googleapis.com/index.html安装了chrome-driver|而且我还安装了Google-chrome浏览器。我想使用chrome浏览器而不是Firefox浏览器运行cucumber测试用例,但我遇到了这个错误。任何帮助表示赞赏。谢谢 最佳答案 我遇到这个问题是因为rbenvshim覆盖了路径。值得检查whichchromedriver指向的位置。对我来说,解决方法是:gemuninstallchromedriver-helper和brewinst

ruby - Watir Webdriver 的页面或对象大小

有什么方法可以使用WatirWebdriver从浏览器获取页面大小(以字节为单位)?我需要为每一页记录它(我对总和感兴趣,而不是每个对象的细节),因此保存到文件并获取文件大小不是合适的方法。我可以使用不同的浏览器,但我更喜欢Firefox, 最佳答案 这个“http://watirwebdriver.com/page-performance/”只能在chrome中使用,但是分组内存似乎有你想要的,安装并要求'watir-webdriver-performance' 关于ruby-Wati

ruby - 如何在 selenium webdriver - ruby​​ 中自动化桌面通知

我正在尝试使用ruby​​中的seleniumwebdriver从gmail桌面通知中获取数据 最佳答案 开箱即用的想法,用Selenium截屏并用OCR处理图像?https://github.com/suyesh/ocr_space我假设Selenium只允许您与页面数据交互。 关于ruby-如何在seleniumwebdriver-ruby​​中自动化桌面通知,我们在StackOverflow上找到一个类似的问题: https://stackoverflo

ruby-on-rails - 带有 Devise 和 rspec : Warden test helpers unreliable 的 Rails 3

我有一个使用Rails3.2和Devise的应用程序。我有一个使用rspec和Capybara的请求测试套件。我尝试在我的登录助手中改用Warden测试助手,而不是让Capybara填写登录表并提交。由于我的测试套件的大小和复杂性,这使我的测试运行时间节省了超过一分半钟。在我的配置中是:RSpec.configuredo|config|config.includeWarden::Test::Helpers,:type=>:requestconfig.after:eachdoWarden.test_reset!endend在上下文中:let!(:current_user){Factory

ruby - 绕过 Element 的方法无法滚动到 View 中 - Watir-webdriver with Ruby

因此,我们的页面中有以下代码:OnOff这是2个单选按钮。'开和关'。“关闭”是默认值。使用Watir-webdriver和Ruby,我们想要选择“打开”单选按钮。我们这样做:browser.radio(:id=>"HasRegistration_true").set但在这样做时,我们得到以下错误:`WebElement.clickElement':Elementcannotbescrolledintoview:[objectHTMLInputElement](Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)我们知道Sele

Ruby - 需要 'watir-webdriver' - 生成一个没有这样的文件的 LoadError ... 为什么?

我是Ruby的新手,非常感谢能帮助我理解这里发生的事情。总结:Gem安装watir-webdriver安装正常开始irb需要“watir-webdriver”...LoadError:没有要加载的文件--watir-webdriver当然这应该响应=>true为什么找不到gem?或者我做错了什么?我在win7上,Railsinstaller(Ruby1.8.7)。 最佳答案 在1.8.7中,您需要先要求ruby​​gems。require'rubygems'这里有一些解释:Howdoesrequirerubygemshelpfind

ruby-on-rails - rails/Prawn : how do I use rails helpers inside a Prawn class?

我正在尝试在prawn类中使用rails3.2助手,但rails抛出:undefinedmethod`number_with_precision'for#Prawn类classQuotePdfControllerdefshow@quote=current_user.company.quotes.where(:id=>params[:id]).firsthead:unauthorizedandreturnunless@quoterespond_with@quote,:layout=>!params[:_pjax]do|format|format.pdfdosend_dataQuotePd