I think that i can reproduce the problem with tweaking a setting in IE.

There is a setting under Internet Options -> Advanced -> Security -> Allow 
active content to run in files on My Computer. This is disabled by default. 
Enable it, restart IE and try if it will make #execute_script working.

Jarmo Pertman
-----
IT does really matter - http://itreallymatters.net

On Wednesday, February 13, 2013 10:15:50 PM UTC+2, Jarmo Pertman wrote:
>
> I just noticed an error in my previous code. I have an extra ' character 
> at the start of src attribute value :(
>
> Please try again with the following correct code:
> <html>
>   <head>
>     <script type="text/javascript" 
> src="file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js"></script>
>   </head>
>   <body>
>     foo
>   </body>
> </html>
>
> Jarmo Pertman
> -----
> IT does really matter - http://itreallymatters.net
>
> On Wednesday, February 13, 2013 3:14:42 PM UTC+2, enroxorz wrote:
>>
>> Please make sure to post your findings. I've been monitoring this because 
>> I also have the same issue as you (didn't post because I didn't have 
>> anything new to add to this).
>>
>> On Tuesday, February 12, 2013 5:51:37 PM UTC-5, captin wrote:
>>>
>>> The issue still exists when trying your suggestion. I will play around 
>>> with security settings and see if that leads to any resolution.
>>>  
>>> Thanks!
>>>
>>> On Saturday, February 9, 2013 5:19:14 AM UTC-6, Jarmo Pertman wrote:
>>>
>>>> To be honest - i'm not sure where's the problem since i cannot 
>>>> reproduce it on my IE8. I have one idea - create a local html file with 
>>>> the 
>>>> contents:
>>>> <html>
>>>>   <head>
>>>>     <script type="text/javascript" 
>>>> src="'file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js"></script>
>>>>   </head>
>>>>   <body>
>>>>     foo
>>>>   </body>
>>>> </html>
>>>>
>>>> Open that file with your internet explorer and try then the JavaScript 
>>>> commands in the developer tools. If they still don't work then it has 
>>>> probably something to do with your IE security settings.
>>>>
>>>> Jarmo Pertman
>>>> -----
>>>> IT does really matter - http://itreallymatters.net
>>>>
>>>>
>>>> On Friday, February 8, 2013 5:51:27 PM UTC+2, captin wrote:
>>>>>
>>>>> Same result. The script errors just continue to pile up.
>>>>>  
>>>>> Do you think this is a bug? If so, is it a json2.js or a watir-classic 
>>>>> issue?
>>>>>  
>>>>> Thanks.
>>>>>  
>>>>>
>>>>> On Friday, February 8, 2013 1:39:14 AM UTC-6, Jarmo Pertman wrote:
>>>>>
>>>>>> That's sad to hear. What if you run execute_script two times in a row 
>>>>>> - will you also get an error for the second run?
>>>>>>
>>>>>> Jarmo Pertman
>>>>>> -----
>>>>>> IT does really matter - http://itreallymatters.net
>>>>>>
>>>>>> On Thursday, February 7, 2013 12:58:36 AM UTC+2, captin wrote:
>>>>>>>
>>>>>>> Jarmo,
>>>>>>>  
>>>>>>> My apologies for the versioning miscommunication. My initial post 
>>>>>>> and initial error messages are correct with Ruby 1.9.3 and 
>>>>>>> Watir-Classic 
>>>>>>> 3.4.0, but the line "
>>>>>>> json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';"
>>>>>>>  
>>>>>>> is probably what threw you off. That was a copy/paste mistake. The line 
>>>>>>> that I truly used for troubleshooting was "
>>>>>>> json2.src='file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js';"
>>>>>>>  
>>>>>>> I hope this clears things up.
>>>>>>>  
>>>>>>> I also tried copying the json2.js file you linked into my 
>>>>>>> watir-classic gem, and then I ran the same troubleshooting commands 
>>>>>>> along 
>>>>>>> with the original watir command I am trying to use. Same results, even 
>>>>>>> though the two json2.js files are slightly different.
>>>>>>>  
>>>>>>>  
>>>>>>>
>>>>>>> On Wednesday, February 6, 2013 11:11:19 AM UTC-6, Jarmo Pertman 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> I just noticed that you had Ruby 1.9.3 vs 1.9.2 and Watir-Classic 
>>>>>>>> 3.3.0 vs 3.4.0 in your error messages.
>>>>>>>> Which one was it actually and why do they differ?
>>>>>>>>
>>>>>>>> Can you try to copy the watir-classic gem's json2.js file over with 
>>>>>>>> the contents of 
>>>>>>>> https://raw.github.com/douglascrockford/JSON-js/master/json2.js and 
>>>>>>>> see if that makes any difference?
>>>>>>>>
>>>>>>>> Jarmo Pertman
>>>>>>>> -----
>>>>>>>> IT does really matter - http://itreallymatters.net
>>>>>>>>
>>>>>>>>
>>>>>>>> On Monday, February 4, 2013 4:53:52 PM UTC+2, captin wrote:
>>>>>>>>>
>>>>>>>>> Jarmo,
>>>>>>>>>  
>>>>>>>>> There is no error when I copy the local json2.js file (located at 
>>>>>>>>> file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js)
>>>>>>>>>  
>>>>>>>>> contents to the IE developer tools window. When I run the stringify 
>>>>>>>>> command 
>>>>>>>>> you gave me, the out put is "{"a":"foo"}". And I get the exact 
>>>>>>>>> same results when I use the other json2.js you linked and then run 
>>>>>>>>> the 
>>>>>>>>> command again.
>>>>>>>>> I also tried the original commands you gave previously (typeof 
>>>>>>>>> JSON and typeof JSON.stringify) after I loaded the json2.js script 
>>>>>>>>> manually, and the outputs were "object" and "function" respectively.
>>>>>>>>>  
>>>>>>>>> In your opinion, is there some sort of automatic loading or 
>>>>>>>>> accessing issue between JSON and IE?
>>>>>>>>>  
>>>>>>>>> Thanks.
>>>>>>>>>  
>>>>>>>>> On Saturday, February 2, 2013 9:47:53 AM UTC-6, Jarmo Pertman 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Can you try by copying all the contents of the json2.js file from 
>>>>>>>>>> file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js
>>>>>>>>>>  to 
>>>>>>>>>> your IE developer tools window? Do you get any errors when doing 
>>>>>>>>>> that too? 
>>>>>>>>>> What does this code return after doing that: JSON.stringify({a: 
>>>>>>>>>> "foo"})
>>>>>>>>>>
>>>>>>>>>> What about using the code at 
>>>>>>>>>> https://raw.github.com/douglascrockford/JSON-js/master/json2.js ?
>>>>>>>>>>
>>>>>>>>>> Jarmo Pertman
>>>>>>>>>> -----
>>>>>>>>>> IT does really matter - http://itreallymatters.net
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thursday, January 31, 2013 1:01:11 AM UTC+2, captin wrote:
>>>>>>>>>>>
>>>>>>>>>>> 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.


Reply via email to