
Ruby
_qqmm
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
watir-webdriver获取某个标签的值
b.span(:id,"result_box").text原创 2012-11-03 18:39:24 · 1888 阅读 · 1 评论 -
ruby watir 学习资料汇总
http://bbs.51testing.com/thread-278944-1-1.html原创 2013-05-23 19:09:08 · 696 阅读 · 0 评论 -
很好的watir-webdriver知识分享
http://dtrex.iteye.com/原创 2013-05-23 19:06:53 · 610 阅读 · 0 评论 -
Ruby Gem 的基础知识和详解
Gem介绍:Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找、安装、升级和卸载软件包,非常的便捷。Ruby 1.9.2版本默认已安装Ruby Gem,如果你使用其它发行版本,请参考“如何安装Ruby Gem”。 Ruby gem包的安装方式:所有的gem包,会被安装到 /[Ruby root]/lib/r转载 2013-05-23 19:03:27 · 855 阅读 · 0 评论 -
ruby run case
#Dir.glob(File.join(File.dirname(__FILE__), 't*.rb')).each {|f| require f }folder = []folder = ['login','register']folder.each {|fo| Dir.glob(File.join(File.dirname(__FILE__), "/cases/#{fo}/test_c原创 2013-04-20 17:39:48 · 493 阅读 · 0 评论 -
ruby retry
def hello i=1 begin puts "hello" a=10/0 rescue if(i<3) i+=1 retry end endendhelloputs "end"原创 2013-04-20 17:36:01 · 745 阅读 · 0 评论 -
ruby 判断一个变量是否定义
irb(main):007:0> a = 1=> 1irb(main):008:0> defined? a=> "local-variable"irb(main):009:0> defined? b=> nilirb(main):010:0> defined? nil=> "nil"irb(main):011:0> defined? String=> "constant"irb转载 2013-04-19 18:51:12 · 3396 阅读 · 0 评论 -
获取字符串中的数字,放入数组并对其求和
# 获取数字放入数组并对其求和ver_no="Verification: 4 + 12 = ?“sum = eval ver_no.scan(/\d+/).join("+")原创 2013-04-24 16:21:28 · 1099 阅读 · 0 评论 -
chrome 启动参数
http://src.chromium.org/svn/trunk/src/chrome/common/chrome_switches.cc参数:--user-data-dir=UserDataDir用途:自订使用者帐户资料夹(如:–user-data-dir="D:\temp\Chrome User Data")参数:--start-maximized用途:启动就最大化参数:转载 2013-04-16 16:09:27 · 2650 阅读 · 0 评论 -
创建独立的Firefox profile
1、关闭所有Filefox浏览窗口 2、运行Firefox Manager,点击windows“开始”-->“运行”,然后在输入框输入firefox.exe -ProfileManager,点击“确定”按钮 3、创建一个新的Profile,只需点击“创建配置文件”按钮,在接着出现的向导窗口里输入配置文件名“seo”, 现在就创建了一个独立的Firefox Profile转载 2013-06-05 09:08:00 · 1025 阅读 · 0 评论 -
testcase testsuite demo
http://www.51testing.com/html/09/n-830909.html原创 2013-06-14 16:38:20 · 549 阅读 · 0 评论 -
ruby 读取yaml文件
ruby 读取yaml文件假如我们有一个写好的yaml文件:program: id: 1 input: 1 2 output: 3注意:":" 后面必须有一个空格读取方式:require 'yaml'problem = YAML.load(File.open("a.yaml"))puts "problem id转载 2013-06-22 17:54:53 · 4287 阅读 · 0 评论 -
Ruby转Exe -- Exerb研究
1. Exerb简介Exerb是一个将ruby脚本程序(.rb)转换成Windows应用程序(.exe)的软件。目前最新版本4.1.0,下载地址:http://downloads.sourceforge.jp/exerb/23470/exerb-4.1.0.zip。2.安装把下载的zip文件解压,进入exerb目录,运行ruby setup.rb。这时exerb和m转载 2012-12-26 15:37:29 · 2619 阅读 · 2 评论 -
chrome init a browser with cookie
#encoding: utf-8require "watir-webdriver"#b = Watir::Browser.new(:firefox, {:profile => 'default'}) # watir webdriver# Which is going to create a new user data directory where all the cookies, bo原创 2016-02-16 16:26:56 · 477 阅读 · 0 评论 -
sublime text 2 快捷键 reindent 设置
[{"keys": ["ctrl+shift+m"], "command": "reindent" , "args": {"single_line": false}}]原创 2016-03-01 20:21:23 · 986 阅读 · 0 评论 -
ruby 递归调用
#encoding: utf-8puts "hello"class REC attr_reader :ids def initialize @ids = [] end def get_work_ticket(days) puts "func get work ticket" if(days>10)原创 2015-04-04 17:57:48 · 2298 阅读 · 0 评论 -
watir-webdriver cookie get value by name
不懂是不是自己没找到的问题,还是watir-webdriver本来就没有根据cookie名称获取对应的cookie值的方法,后来没有办法,还是自己写了一个require 'watir-webdriver'url = 'http://xxx.xxx.com'$b = Watir::Browser.new :chrome # 新建一个浏览器实例$b.goto urldef cookie原创 2013-06-26 16:09:54 · 1204 阅读 · 0 评论 -
发一些乙醇原创的资料
发一些乙醇原创的资料,其他的大神一般不生产资料,他们只是乙醇的搬运工而已。书籍类:webidriver实用指南:python版本真的来了!!!https://github.com/easonhan007/webdriver_guide/blob/master/README.md。webdriver实用指南,大家收藏一下,遇到问题翻一翻,当作工具书用。里面有完备的java转载 2013-11-20 20:21:28 · 3697 阅读 · 0 评论 -
Use Watir-WebDriver behind proxy
Good Ruby script#!/usr/bin/ruby def create_firefox_profile profile = Selenium::WebDriver::Firefox::Profile.new profile['network.proxy.ftp'] = "proxy.foo.com" profile['network.转载 2013-08-24 10:33:22 · 908 阅读 · 0 评论 -
watir-webdriver auto test framework
checkout address https://watir-webdriver-autotest.googlecode.com/svn/trunk原创 2013-07-23 09:46:27 · 576 阅读 · 0 评论 -
ruby system 命令
ruby的system命令,可以直接写在文件中,运行其他ruby文件。system "ruby n.rb"原创 2013-04-12 10:24:28 · 2828 阅读 · 0 评论 -
Quick and easy Watir test suites with Test::Unit
Quick and easy Watir test suites with Test::Unithttp://www.natontesting.com/2009/09/24/quick-and-easy-watir-test-suites-with-testunit/Posted on September 24, 2009A test team usually ha转载 2012-09-04 11:08:56 · 594 阅读 · 0 评论 -
Migrating Unit Tests from Selenium to Watir Webdriver
Migrating Unit Tests fromSelenium to Watir WebdriverPosted by JordonPhillipsUntil recently,HiretheWorld did all it’s front-end testing using Selenium.Our tests were quite old and they were pretty转载 2012-10-17 15:30:16 · 1092 阅读 · 0 评论 -
watir-webdriver 在线文档
http://rubydoc.info/gems/watir-webdriver/frames原创 2012-10-16 15:41:02 · 479 阅读 · 0 评论 -
watir-webdriver time out error
client = Selenium::WebDriver::Remote::Http::Default.newclient.timeout = 180 # seconds – default is 60b = Watir::Browser.new :firefox, :http_client => client原创 2012-10-16 15:35:29 · 643 阅读 · 0 评论 -
incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.
从mysql官方http://dev.mysql.com/downloads/mysql下载 mysql-connector-c-noinstall-6.0.2-win32 解压到e:/。注意根据自己的实际情况下载相对应的版本,这里使用非安装版。or Ruby 1.9.2:gem install mysql --platform=ruby -- --with-mysql-dir=e:/转载 2012-10-13 15:14:38 · 2809 阅读 · 0 评论 -
Can’t convert fixnum to string during rake db:create
Can’t convert fixnum to string during rake db:create发表于 2011 年 8 月 20 日rake aborted!can’t convert Fixnum into StringAs such, it probably considers your password value of 123 to be an转载 2012-10-13 15:12:36 · 916 阅读 · 0 评论 -
linux rails 环境安装
一. Ruby 安装1. 得到Ruby安装包 wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz 安装的1.8.7版本2. 解压安装 tar -xzvf ruby-1.8.7-p174.tar.gz cd ruby-1.8.7-p174 ./conf转载 2012-09-22 10:54:06 · 2500 阅读 · 0 评论 -
Ubuntu Linux 11.04ruby&watir运行环境
UbuntuLinux 11.04ruby&watir运行环境:Step 1.Ruby安装$sudo apt-get install ruby查看是否安装成功:$ ruby -vruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]Step 2. RubyGems安装(管理ruby包)$sudo apt转载 2012-09-20 17:28:00 · 945 阅读 · 0 评论 -
ruby 插入中文失败乱码
在使用 ruby 插入中文的时候,出现失败或者乱码,一般的原因是连接数据库的时候没有指定连接使用的字符串编码,若是这样的情况,在连接的文件中指定与 mysql 一致的编码即可。 def initialize(localhost='localhost',username='root',password='aaa123',database='td_autotest') re原创 2012-09-13 14:13:50 · 1206 阅读 · 0 评论 -
ruby自动翻译excel内容
最近在谷歌实行收费,在寻找一个方法,模拟人工调用,自动读取翻译的内容,下面为今天的劳动成果:#encoding:utf-8require 'uri'require 'open-uri'require 'win32ole'translateFile='D:\RAWTest\translate\en.xlsx' #change to your file which needs to tr原创 2012-12-24 15:42:52 · 746 阅读 · 0 评论 -
watir 语法
# 使用Watir工具,需要在脚本中加上 require 'watir' # 创建一个IE的实例 ie = Watir::IE.new # 或者在创建的同时直接转到页面 ie = Watir::IE.start('http://www.text.com/') # Watir使用start方法同时创建一个浏览器实例并转到一个页面。 # IE浏览速度转载 2012-12-24 17:59:24 · 568 阅读 · 0 评论 -
Ruby 获取当前执行文件所在路径 ; ruby获取当前路径
require ‘pathname’ #获得当前执行文件的完整路径puts Pathname.new(__FILE__).realpath#获得当前执行文件的目录完整路径puts Pathname.new(File.dirname(__FILE__)).realpath原创 2012-12-26 17:26:41 · 5384 阅读 · 0 评论 -
Ruby 1.9 - invalid multibyte char (US-ASCII)
ruby出现编码警告的问题,解决方法有下面几种1. 在文件开始加入 #encoding:utf-82. 在文件开始加入 #encoding:gbk puts3. encoding 后面的编码,要与rb文件的编码一致原创 2013-03-22 15:28:53 · 906 阅读 · 0 评论 -
ruby异常处理
Ruby语言虽然是一款比较简单应用的语言,但是在实际编写中同样还会出现各种各样的错误警告等。这就用到了异常处理。下面我们就来看看Ruby异常处理结构。Ruby on Rails列表页面如何进行优化Ruby on Rails创建购物页面技巧一点通Ruby on Rails自动生成文档技巧大讲堂Ruby代码管理经验分享Ruby创建构造器技巧分享Rub转载 2013-03-01 11:43:07 · 2204 阅读 · 0 评论 -
ruby字符串处理
Ruby字符串处理函数1.返回字符串的长度str.length => integer Ruby字符串处理函数2.判断字符串中是否包含另一个串str.include? other_str => true or false "hello".include? "lo" #=> true "hello".include? "ol" #=> false转载 2013-02-27 14:38:48 · 454 阅读 · 0 评论 -
Test::Unit参考手册
http://www.kuqin.com/rubycndocument/man/addlib/Test-Unit.html原创 2013-03-08 17:45:48 · 514 阅读 · 0 评论 -
ruby自动注册163邮箱
下面一段是ruby自动注册163邮箱的代码,未封装,未加入验证码识别,有兴趣的朋友可以完善一下。#encoding:utf-8#auto reg email of mail.163.com Time:2013-1-30 15:15:18require "watir-webdriver"puts "auto reg email of 163"def mail_append(len原创 2013-01-30 17:16:16 · 5486 阅读 · 0 评论 -
ruby与mysql兼容性问题:libmySQL.dll
在Windows下,如果使用了mysql 5.1,不但在安装mysql.gem时候会报ri和rdoc的错误,而且在执行 rake db:migrate时候也会报错: 这是由于mysql5.1里面所带的libmySQL.dll和rails不兼容(至少在2.3.5还是如此)。可以从网上下载一个旧版本的libmySQL.dll,将其放到ruby的bin目录即可。 下载地址:转载 2013-02-18 14:20:04 · 1778 阅读 · 0 评论 -
ruby脚本,自动登录csdn博客
最近经常需要登录csdn,写了一个自动登录的脚本,如下#encoding:utf-8require "watir-webdriver"b = Watir::Browser.new:chrome#url = "https://passport.youkuaiyun.com/account/login"url = "http://write.blog.youkuaiyun.com/postlist"u =原创 2013-01-21 17:28:19 · 1533 阅读 · 0 评论