Cur*_*ler 2 firefox watir firewatir headless-browser watir-webdriver
我需要能够使用我的Hudson构建运行我的Ruby脚本,但不希望尝试打开浏览器窗口.我试过了:
batman:ETW cmiller$ ./createAccount.rb -b
Run Code Online (Sandbox Code Playgroud)
但这没用.
如何使用FireWatir无头运行我的Ruby脚本?
在Mac OSX上运行
我建议使用PhantomJS(http://phantomjs.org/download.html)将二进制文件添加到您的路径并运行:
MEDBEDbs-iMac:~ medbedb$ irb
1.9.3p392 :001 > require 'watir-webdriver'
=> true
1.9.3p392 :002 > b = Watir::Browser.new :phantomjs
=> #<Watir::Browser:0x..fe670a70a449fe1ca url="about:blank" title="">
1.9.3p392 :003 > b.goto "www.google.com"
=> "http://www.google.md/"
1.9.3p392 :004 > b.url
=> "http://www.google.md/"
1.9.3p392 :005 > b.title
=> "Google"
1.9.3p392 :007 > b.text
=> "+??\n?????\n????????\n?????\nPlay\n?????\n????\n?????????\n???\n?????\n×\n???????? ??????? ????? ???????\n????????? Google Chrome\n\n????o??\n\n \n??????????? ?????\n???????? ???????????\n\nGoogle.md ???????????? ??: Moldoveneasc?\n\n????????? ???????????? ? GoogleGoogle.com\n© 2013 - ??????? ? ????????"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5986 次 |
| 最近记录: |