Using watir-webdriver, how can I fire an event without waiting for the page to l

link: http://stackoverflow.com/questions/6127031/using-watir-webdriver-how-can-i-fire-an-event-without-waiting-for-the-page-to-l

Question:

The code

for i in 0..10  
  $browser.link(:id => "send_link").fire_event("onclick")
  puts "Click #" + i.to_s
end

only displays "Click #0" to the console before crashing with an unable to locate element error. I need it to click the link 10 times, even while the page is trying to load from the first click. Is there a way to do this using watir-webdriver, or will I have to use the win32api to hijack the mouse and do a hard click?

Edit: For the time being, I attempted to get around this by using the hardware click method that worked for a different issue I had using watir and IE8, but it doesn't seem to work with watir-webdriver and Firefox 4.

http://wiki.openqa.org/display/WTR/Right+Click+an+Element

 

Answer:

 

have you tried using .click_no_wait to see if that will work for you?

10.times do |i|  
  $browser.link(:id => "send_link").click_no_wait
  puts "Click #" + i.to_s
end
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值