I have encountered an issue with execute_script using IE9 with ruby
1.9.3p327 and watir-classic 3.4.0. I was doing some research and found my exact
same issue detailed at Stack
Overflow<http://stackoverflow.com/questions/14142905/issue-with-execute-script>,
but the thread is stale (and I'm too new to be able to comment on the issue
there). Jarmo was assisting but the OP hasn't responded in over three weeks.
I hate redundancy but I also hate waiting indefinitely so I figured I'd
pose the question here. Using the following code:
browser.execute_script "window.confirm = function() { return true; }"
I get the following error:
WIN32OLERuntimeError: (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.
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
`method_missing'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
`rescue in execute_script'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:22:in
`execute_script'
from (irb):14
from C:/Ruby193/bin/irb:12:in `<main>'
The following JavaScript errors are also present in the browser:
SCRIPT1014: Invalid character
*json2.js, line 1 character 1*
SCRIPT5009: 'JSON' is undefined
*edit-location?pageTitle=Edit
Location&contactId=8590307238&folderId=0&folderName=%5BGlobal%5D&cardId=8590242330,
line 1 character 1*
Jarmo, I performed the actions you suggested at Stack Overflow and got the
following results:
>> typeof JSON
"undefined"
>> typeof JSON.stringify
"'JSON' is undefined"
>> if (!window.JSON || !window.JSON.stringify) {
var json2=document.createElement('script');
json2.type='text/javascript';
json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';
document.getElementsByTagName('head')[0].appendChild(json2)
}
SCRIPT1014: Invalid character
*json2.js, line 1 character 1* <https://groups.google.com/forum/0>
[object] {
nextSibling : ,
onresizeend : null,
onrowenter : null,
aria-haspopup : "",
childNodes : [object],
ondragleave : null,
oncut : null,
clientHeight : 0,
onbeforepaste : null,
ondragover : null
...
}
Do you or anyone else have any further troubleshooting steps I can attempt?
Thanks!
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.