躺在沙滩上的小猪

快乐的每一天

#

灵活的Watir。

记得以前用python写过一个日报填写的东西,可是涉及的库太多,感觉很不好。
今天刚刚看到Watir,变将它重写了一下:

 require 'Watir'

#登陆地址
pform_login_url='http://ip/pform/common/login.jsp'
#填写日志地址
pform_input_url='http://ip/pform/nbgl/datainputInitAction.do'

ie
=Watir::IE.new

#输入用户名&密码
puts '登陆.'
ie.goto(pform_login_url)
ie.text_field(:name,
'j_username').set('工号')
ie.text_field(:name,
'j_password').set('密码')

#提交页面
ie.button(:name,'submit').click

#转向日报填写地址
puts('填写日报')
ie.goto(pform_input_url)

#填写日报时间
ie.text_field(:name,'fillInDate').set('2006-01-24')

#选择项目
ie.select_list(:name,'detailList[0].projectId').select('***项目')
#具体事项
#
ie.select_list(:name,'detailList[0].workId').select('代码开发')
#
工作内容
ie.text_field(:name,'detailList[0].workContent').set('代码开发')
#正常工作时长
ie.text_field(:name,'detailList[0].workNum').set('8')
#加班工作时长
ie.text_field(:name,'detailList[0].overtimeNum').set('0')

puts(
'提交日报')
#提交表单
ie.button(:id,'submit').click

if ie.contains_text('成功')
  puts 
'日报提交成功!'
else
  puts 
'日报提交失败!'
end

ie.close
#end

很简洁,但是有个问题,就是中文的问题,正好在 
http://www.blogjava.net/raimundox/archive/2006/01/12/27676.html
这里看到关于中文处理的方法,改进之,偷懒,直接拷贝过来:)
OK!提交之.

posted @ 2006-01-23 17:02 martin xus| 编辑 收藏

Watir Quick Start!

http://rubyforge.org/projects/wtr/

WATIR stands for "Web Application Testing in Ruby". Watir (pronounced water) is a free, open-source functional testing tool for automating browser-based tests of web applications.

目前最新版本为1.4.1只支持Windows IE.
Watir2.0会支持Linux和Firefox(http://rubyforge.org/pipermail/wtr-general/2005-May/001907.html)

require 'watir' 

#测试url
test_site='http://www.4ya.cn/dosearchsite.action'

#打开新的窗口
ie = Watir::IE.new

#转到测试页面
ie.goto(test_site)

puts 
'Test Begin'


#输入需要查询的字符 'FreeMarker'
ie.text_field(:name,'searchQuery.queryString').set('FreeMarker')
#点击按钮
ie.button(:value,'Go').click

#检测查询结果页面是否包括 FreeMarker Quick Start 该文章
#
如果有,则测试通过,否则测试失败!
if ie.contains_text('FreeMarker Quick Start')
  puts 
'Yeah!I can find FreeMarker Quick Start'
else
  puts 
'Ooooops!I can\'t find any more wich associate with FreeMarker Quick Start'
end

#关闭浏览器
ie.close
#end

参考:
Watir User Guide

资源:
http://watir.net/

posted @ 2006-01-23 15:59 martin xus| 编辑 收藏

Lightbox JS

Lightbox JS is a simple, unobtrusive script used to to overlay images on the current page. It's a snap to setup and works on all modern browsers.

http://www.huddletogether.com/projects/lightbox/

image #1

posted @ 2006-01-20 16:02 martin xus| 编辑 收藏

ActiveState.Komodo.v3.5.2.Professional Keygen

http://www.activestate.com/

Komodo is ActiveState's cross-platform, multi-language Integrated Development Environment (IDE). Komodo supports development in numerous languages, including Perl, Python, PHP, Ruby, Tcl, XSLT, JavaScript, and more.

http://www.blogjava.net/Files/martinx/ActiveState.Komodo.v3.5.2.Professional.Incl.Keygen.rar

posted @ 2006-01-20 11:47 martin xus| 编辑 收藏

Moo.ajax: 1.3kb for all your asynchronous needs

http://ajaxian.com/archives/mooajax-13kb-for-all-your-asynchronous-needs
Valerio Proietti, the creator of Moo.fx, has now created a micro library for Ajax, moo.ajax.

I noticed many of you requested if it would have been possible to use the full prototype, instead of the lite one I provided with the full download of moofx, to use its ajax capabilities along with the effects. Sure you can, but wouldn’t it be cooler if there was a more lightweigt one?

Just to continue my mission in small javascripting, I have arranged this moo.ajax, in just 1.3kb of uncompressed sweetness.

read more for instructions, or download the script. As always, any comments/corrections/suggestions are highly appreciated.

moo.ajax is a very simple ajax class, to be used with prototype.lite from moo.fx. It’s roughly based on the prototype one, so their usage are very similar.

The request
to make any request just call

new ajax(url, options);


The options
method: choose either post or get. The default is post.
posyBody postBody: if you choose post as method, you can write parameters here.
onComplete: a function that will be fired when your request is complete. The request object will be passed as a parameter of the function.
update: an dom element or an element’s id. This element will be filled with the request’s responsetext.
An example
This will call my script.php via post, setting as parameter sleep=3. When the request is complete I want an alert with the response text, and I want an element to be updated with the responsetext as well.

new ajax ('sleep.php', {postBody: 'sleep=3', update: $('myelementid'), onComplete: myFunction});
function myFunction(request){
  alert(request.responseText);
}

posted @ 2006-01-20 09:31 martin xus| 编辑 收藏

仅列出标题
共28页: First 上一页 9 10 11 12 13 14 15 16 17 下一页 Last