lib/watir/ie-class.rb in watir-2.0.2 vs lib/watir/ie-class.rb in watir-2.0.3

- old
+ new

@@ -418,10 +418,10 @@ end # Execute the given JavaScript string def execute_script(source) document.parentWindow.eval(source.to_s) - rescue WIN32OLERuntimeError #if eval fails we need to use execScript(source.to_s) which does not return a value, hence the workaround + rescue WIN32OLERuntimeError, NoMethodError #if eval fails we need to use execScript(source.to_s) which does not return a value, hence the workaround wrapper = "_watir_helper_div_#{rand(100000)}" escaped_src = source.to_s escaped_src = escaped_src.gsub("'", "\\\\'") cmd = "var e= document.createElement('DIV'); e.id='#{wrapper}'; e.innerHTML= eval('#{escaped_src}');document.body.appendChild(e);" document.parentWindow.execScript(cmd)