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.
