- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在尝试将应用程序部署到使用 Watir webdriver 的 Heroku。它在本地成功运行。根据这个问题的答案:Can you deploy Watir on Heroku to generate HTML Snapshots? If so, how? , 你能行的。我按照这个答案 https://stackoverflow.com/a/21267376/3192470 中的步骤操作.我的 app.rb 看起来像这样:
require "sinatra"
require "rubygems"
require "shotgun"
require "rake"
require "watir"
get '/sending_out' do
browser = Watir::Browser.new :phantomjs
erb :index
end
但是当使用这些日志部署到 Heroku 时它会崩溃:
2014-10-24T13:01:10.620468+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/launcher.rb:32:in `launch'
2014-10-24T13:01:10.620465+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/launcher.rb:35:in `block in launch'
2014-10-24T13:01:10.620480+00:00 app[web.1]: credits.rb:44:in `rencredit'
2014-10-24T13:01:10.620496+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
2014-10-24T13:01:10.620510+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
2014-10-24T13:01:10.620534+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:217:in `call'
2014-10-24T13:01:10.620590+00:00 app[web.1]: /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
2014-10-24T13:01:10.620460+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/binary.rb:60:in `execute'
2014-10-24T13:01:10.620475+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/browser.rb:46:in `initialize'
2014-10-24T13:01:10.620491+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
2014-10-24T13:01:10.620506+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
2014-10-24T13:01:10.620524+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
2014-10-24T13:01:10.620587+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
2014-10-24T13:01:10.620469+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/bridge.rb:24:in `initialize'
2014-10-24T13:01:10.620484+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
2014-10-24T13:01:10.620500+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
2014-10-24T13:01:10.620525+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
2014-10-24T13:01:10.620526+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
2014-10-24T13:01:10.620528+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
2014-10-24T13:01:10.620529+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
2014-10-24T13:01:10.620574+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
2014-10-24T13:01:10.621081+00:00 app[web.1]: ip-10-226-67-253.ec2.internal - - [24/Oct/2014:13:01:10 UTC] "POST /sending_out HTTP/1.1" 500 30
2014-10-24T13:01:10.620462+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/binary.rb:34:in `start_with'
2014-10-24T13:01:10.620477+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/watir-5.0.0/lib/watir/loader.rb:9:in `initialize'
2014-10-24T13:01:10.620492+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
2014-10-24T13:01:10.620507+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
2014-10-24T13:01:10.620531+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
2014-10-24T13:01:10.620588+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-24T13:01:10.620459+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/binary.rb:127:in `path'
2014-10-24T13:01:10.620474+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver.rb:67:in `for'
2014-10-24T13:01:10.620490+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
2014-10-24T13:01:10.620505+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
2014-10-24T13:01:10.620517+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
2014-10-24T13:01:10.620584+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
2014-10-24T13:01:10.620464+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/launcher.rb:70:in `start_silent_and_wait'
2014-10-24T13:01:10.620479+00:00 app[web.1]: credits.rb:44:in `new'
2014-10-24T13:01:10.620494+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
2014-10-24T13:01:10.620509+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
2014-10-24T13:01:10.620532+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
2014-10-24T13:01:10.620586+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
2014-10-24T13:01:10.620483+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
2014-10-24T13:01:10.620499+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
2014-10-24T13:01:10.620513+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
2014-10-24T13:01:10.620573+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
2014-10-24T13:01:10.620761+00:00 app[web.1]: 83.245.232.99 - - [24/Oct/2014 13:01:10] "POST /sending_out HTTP/1.1" 500 30 0.3206
2014-10-24T13:01:10.620466+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/firefox/socket_lock.rb:20:in `locked'
2014-10-24T13:01:10.620481+00:00 app[web.1]: credits.rb:36:in `block in <main>'
2014-10-24T13:01:10.620497+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
2014-10-24T13:01:10.620511+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
2014-10-24T13:01:10.620535+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:210:in `call'
2014-10-24T13:01:10.620592+00:00 app[web.1]: /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
2014-10-24T13:01:10.620471+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/common/driver.rb:31:in `new'
2014-10-24T13:01:10.620486+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
2014-10-24T13:01:10.620502+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
2014-10-24T13:01:10.620514+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
2014-10-24T13:01:10.620537+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
2014-10-24T13:01:10.620593+00:00 app[web.1]: /app/vendor/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
2014-10-24T13:01:10.620453+00:00 app[web.1]: Selenium::WebDriver::Error::WebDriverError - Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=:
2014-10-24T13:01:10.620472+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/common/driver.rb:31:in `for'
2014-10-24T13:01:10.620487+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
2014-10-24T13:01:10.620503+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
2014-10-24T13:01:10.620515+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
2014-10-24T13:01:10.620555+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-24T13:01:10.621098+00:00 app[web.1]: http://sleepy-dawn-1804.herokuapp.com/ -> /sending_out
2014-10-24T13:01:10.625080+00:00 heroku[router]: at=info method=POST path="/sending_out" host=sleepy-dawn-1804.herokuapp.com request_id=ab9957cb-f2af-416c-9055-8fe4d4ccae69 fwd="83.245.232.99" dyno=web.1 connect=1ms service=327ms status=500 bytes=326
2014-10-24T13:19:46+00:00 heroku[slug-compiler]: Slug compilation started
2014-10-24T13:19:56+00:00 heroku[slug-compiler]: Slug compilation finished
2014-10-24T13:19:56.715255+00:00 heroku[api]: Deploy a3750e4 by ___
2014-10-24T13:19:56.715329+00:00 heroku[api]: Release v13 created by ___
2014-10-24T13:19:56.987774+00:00 heroku[web.1]: State changed from up to starting
2014-10-24T13:19:59.188226+00:00 app[web.1]: == Sinatra has ended his set (crowd applauds)
2014-10-24T13:19:59.372012+00:00 heroku[web.1]: Starting process with command `bundle exec ruby credits.rb -p 38378`
2014-10-24T13:19:59.936031+00:00 app[web.1]: bash: bundle: command not found
2014-10-24T13:19:58.792208+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-10-24T13:20:00.744914+00:00 heroku[web.1]: State changed from crashed to starting
2014-10-24T13:20:00.744331+00:00 heroku[web.1]: State changed from starting to crashed
2014-10-24T13:20:00.731432+00:00 heroku[web.1]: Process exited with status 127
2014-10-24T13:20:00.979441+00:00 app[web.1]: [2014-10-24 13:20:00] INFO WEBrick::HTTPServer#start done.
2014-10-24T13:20:00.979326+00:00 app[web.1]: [2014-10-24 13:20:00] INFO going to shutdown ...
2014-10-24T13:20:01.793815+00:00 heroku[web.1]: Process exited with status 0
2014-10-24T13:20:02.890977+00:00 heroku[web.1]: Starting process with command `bundle exec ruby credits.rb -p 8176`
2014-10-24T13:20:03.432512+00:00 app[web.1]: bash: bundle: command not found
2014-10-24T13:20:04.173800+00:00 heroku[web.1]: State changed from starting to crashed
2014-10-24T13:20:04.164173+00:00 heroku[web.1]: Process exited with status 127
2014-10-24T13:20:04.812284+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sleepy-dawn-1804.herokuapp.com request_id=f0b2bb74-8eaa-4a4c-801f-97ab9d442f04 fwd="54.166.216.157" dyno= connect= service= status=503 bytes=
2014-10-24T13:20:06.224767+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/sending_out" host=sleepy-dawn-1804.herokuapp.com request_id=eb306448-91ee-40ea-89ec-7756e277e986 fwd="83.245.232.99" dyno= connect= service= status=503 bytes=
而且当我将它推送到 Heroku 时,它认为它是一个 phantomjs 应用程序:
PhantomJS app detected
对于这一切我们能做些什么?这完全有可能从 Heroku 运行 Watir 吗?
编辑:来自 Heroku 支持的回答:
Watir requires selenium, which requires an X server install on the machine. Because our dynos aren't meant to launch graphic applications, they don't have any X server installed, and therefore can't install Selenium. Therefore, I'm afraid it's not going to be possible to use Watir in your application.
最佳答案
是的,这是可能的!只需按照本文中的步骤操作:https://github.com/edelpero/watir-examples/blob/master/watir_on_heroku.md .
很快:
$ heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
$ touch .buildpacks
然后将这些行添加到您新创建的目录.buildpacks:
https://github.com/heroku/heroku-buildpack-ruby
https://github.com/stomita/heroku-buildpack-phantomjs
然后在终端:
$ heroku config:set PATH="/usr/local/bin:/usr/bin:/bin:/app/vendor/phantomjs/bin"
$ heroku config:set LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:/app/vendor/phantomjs/lib
然后将这些更改推送到 Heroku,并且
Watir::Browser.new :phantomjs
按照通常的 Watir 代码应该可以工作!
关于ruby - 部署到 heroku 的 Watir 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26548854/
这是我正在使用的 Watir 代码: require 'watir-classic' browser = Watir::IE.new browser.link(:class, "Wizardbutto
在我们的应用程序中,我们有一些具有以下属性的输入标签: 我已经尝试了大多数 watir 输入法,但没有任何方法可以识别这个对象。任何人都可以为我照亮一点吗? 我的 watir 版本是 1.6.5。
我能够在下拉列表中设置一个选项,但随后我收到一条错误消息。我找到了一个会返回相同错误的在线网站: http://www.100candles.com/floating_candles.htm irb(
希望有人可以帮助我解决我在 Cucumber/Watir 中遇到的转义字符问题。 我有自动化测试设置。当我执行搜索时,我用来验证搜索是否返回正确结果的断言之一是检查页面中的文本。所以我的代码看起来像这
在文本字段中输入文本后,我需要自动执行键盘上的“Enter”键操作。 我试过 @browser.send_keys :enter但这并没有起到作用。也试过@browser.text_field(:na
我想知道 watir-webdriver 是否能够记录任何控制台错误的输出? 这相当于在浏览器中手动打开控制台并在页面加载时观察 JS 错误。我可以通过 watir-webdriver 捕获它并登录/
我想从以下值中找到并单击 Line Lo 值。以下 li 有超过 100 条记录具有相同的类名。如何找到 Line Lo 并单击该值。
有一个repository of tests对于 Mozilla 插件站点,尽管它是使用 Selenium 编写的。我想知道是否有 Watir 可用的真实示例,以便我可以看到专业人士如何实现该框架?
我在处理以下情况时遇到问题。 我正在编写测试脚本,它将让我使用谷歌浏览器登录到系统。 我正在从 excel 中读取数据。 第一组数据的用户名/密码组合不正确。 场景是当输入的密码不正确时,弹出窗口显示
在下面的 html 中 Name: 12121 如何使用 Watir 访问“12121”文本? 最佳答案 要获取潜台词 12121,请使用正则表达式。 gsub 执行搜索和替换操作。它将搜索所有非
我有以下div ... Test 我想提出一个 Watir 查询来测试它我想出了以下(我只需要第一个)... def item_present? # @
我想将一个元素拖放到另一个元素的位置,从 watir-webdriver 脚本中触发。 “拖放”是指拿起一个可拖动元素并将其释放到另一个元素上。 “可能”是指可以从 watir-webdriver 脚
使用 watir-webdriver 时,如何将控制组合键发送到元素? 目前我可以使用以下代码向元素发送一个字符串; $browser.frame(:id,"ws-txt-editor").div(:
我们的网络应用程序有一些事件代码来“格式化”粘贴到字段中的任何文本,这样任何 HTML 样式都不会破坏我们的数据。 预加载浏览器剪贴板以便我可以测试粘贴到输入字段的好方法是什么? 有没有什么方法可以通
require 'watir' ie = Watir::Browser.new ie.goto "http://www.wallpapers.com/windows/Wallpapers/Anim
我有一部分类似于以下内容的 HTML: Text Goes Here ... rest of table 没有 ID、没有标题、没有任何类型的描述符来轻松识别包含文本的 div。 当页面上发生
是否可以将 watir-webdriver 附加到已打开的浏览器窗口? 最佳答案 Watir-webdriver 建立在 selenium-webdriver 之上,目前这是一个待定的功能。 见:ht
我正在使用 Watir 来自动测试 web 应用程序。 在其中一个页面中,我有类似 htis 的内容 但是我能够识别 HTML 元素来访问它。 我需要访问 id="1"value="TIMESH
嗨,出于 SEO 的目的,我们需要访问 html 页面上的 META 标签。但是 Watir 不支持 META 标签。还有其他方法可以访问不受支持的 HTML 标签吗? 任何帮助表示赞赏。 嗨,我找到
我需要检查某个列是否显示在表中。 每列都有一个带有唯一 ID 的 TH 标题。 检查表中 TH 元素是否存在的最佳方法是什么? 这是表格代码的示例。 Nam
我是一名优秀的程序员,十分优秀!