watir_省时-将Watir用作ASP.NET项目中的启动程序

watir

watir

Often when you're inching forward within an ASP.NET project you'll find yourself repeating actions over and over again to get to a certain page, often three or four actions in to the application. As someone who hates repetitive actions this is what I do.

通常,当您在ASP.NET项目中逐步前进时,您会发现自己一遍又一遍地重复操作以到达某个页面,通常是应用程序中的三到四个操作。 作为讨厌重复动作的人,这就是我要做的。

(These examples are in VS2005, but will work in VS2003, although the property dialogs have changed)

(这些示例在VS2005中,但在属性对话框已更改的情况下在VS2003中可用)

I use Watir to automate the clicks that will get me to where I'm going and set my Watir script to startup when I press F5 to start my project debugging.

我使用Watir来使点击自动进行,将我带到我要去的地方,并在按F5键开始项目调试时将Watir脚本设置为启动。

In this example, I have a script called justsignon.rb that signs on, visits the customer's accounts page, then goes to their Account History page. It's that page that I am currently debugging so I want to automatically show up there in a certain state when I start debugging.

在此示例中,我有一个名为justsignon.rb的脚本,该脚本登录后,访问客户的帐户页面,然后转到其“帐户历史记录”页面。 这是我当前正在调试的页面,因此我想在开始调试时以某种状态自动显示在该页面上。

require 'watir'

需要“ watir”

include Watir

包括瓦蒂尔

require 'test/unit'

要求“测试/单位”

class WatirMakerRecorded < Test::Unit::TestCase

类WatirMakerRecorded <Test :: Unit :: TestCase

    def test_recorded

def test_recorded

        ie = IE.new

即= IE.new

        ie.goto('http://localhost:4970/MobileDemo/default.aspx')

ie.goto('http:// localhost:4970 / MobileDemo / default.aspx')

        ie.text_field(:name, 'userTextBox').set('testuser1')

ie.text_field(:name,'userTextBox')。set('testuser1')

        ie.text_field(:name, 'passwordTextBox').set('123456')

ie.text_field(:name,'passwordTextBox')。set('123456')

        ie.button(:name, 'signInCommand').click

ie.button(:name,'signInCommand')。click

        ie.link(:text, /Hanselman/).click

ie.link(:text,/Hanselman/).click

        ie.link(:text, "Account History").click        #UPDATE - the debugger will detach if the spawned process ends, so wait for ENTER

ie.link(:text,“ Account History”)。click #UPDATE-如果生成的进程结束,调试器将分离,因此请等待ENTER

        gets

得到

    end

结束

end

结束

As I move forward in my development process I use different scripts to get me to different states.  This easily adds up to as much as 15 minutes to a half hour of rote "monkey clicking" that is usually wasted time.

在开发过程中,我使用不同的脚本来使自己进入不同的状态。 这很容易导致长达15分钟到半小时的死记硬背“猴子敲门”,这通常是浪费时间。

翻译自: https://www.hanselman.com/blog/time-saver-using-watir-as-a-startup-program-in-your-aspnet-projects

watir

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值