`
lilingjay
  • 浏览: 8207 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics