简体   繁体   中英

Watir-Classic 3.1.0 execute_script issue

I am in the process of upgrading from WATIR 2.0.4 to 3.1.0. I ran into the following error when trying to "kill pop-ups" before they get executed. What can I do to fix this?

Windows XP

Ruby 1.9.3

Cucumber 1.1.9

Watir-Classic 3.1.0

(in OLE method `execScript': )
    OLE error code:80020101 in <Unknown>
      Could not complete the operation due to error 80020101.
    HRESULT error code:0x80020009
      Exception occurred. (WIN32OLERuntimeError)

29
30Then /^I kill the popups$/ do
31  @browser.execute_script "window.confirm = function() { return true; }"
32  @browser.execute_script "window.alert = function() { return true; }"
33  @browser.execute_script "window.prompt = function() { return true; }"

This means that you're getting some JavaScript error. You could see more of that error message from your IE.

Nevertheless i'd recommend you to use Watir Alert API instead. Refer to the usage examples at http://watirwebdriver.com/javascript-dialogs/

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