简体   繁体   中英

how to click on browser “stop loading this page” using ruby watir?

I want to click on browser "stop loading this page" icon, when timeout error occurs,what should i do for it? Some thing like this:

browser.stop   # this is wrong.

I searched forever and the best I could come up with was:

b = Watir::Browser.new
b.driver.manage.timeouts.implicit_wait = 3

This worked great for me with firefox.

Just try this logic when you want to stop the loading,

@browser.send_keys :escape

It is not the best way of doing what you want but still the above approach worked out for me.

If you use Watir-Webdriver then you can try this for IE

@browser.execute_script "document.execCommand('Stop')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM