[jawsscripts] Re: Problem capturing text using DOM in IE 11

  • From: "John Robichaud" <John_Robichaud@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Mon, 15 Dec 2014 17:01:57 -0500

Bob,
I'm using your code successfully under IE 11.  
Do you or  anyone else have any idea why the method createTextRange() does
not seem to work under IE11.  I've used it for years with the HTML Body
object.  It provides a great way for selecting text on a page.
John

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Bob
Sent: Saturday, December 13, 2014 3:22 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Problem capturing text using DOM in IE 11

If the content your trying to access has id's assigned to the elements then
this can also be helpful:

Script Test2 ()
Var
     Object HTML, Object oElement,
     String sText

     Let HTML = IEGetCurrentDocument ()
Let oElement = HTML.getElementById("ID of html tag")
     Let sText = oElement.innerText

     MessageBox (sText)

EndScript

This should just give the text included in a single html element with the
matching id.

Bob


-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of John Robichaud
Sent: 12 December 2014 18:00
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Problem capturing text using DOM in IE 11

Bob,
Ignore my previous email. Your code does work in IE 9.
John

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Bob
Sent: Friday, December 12, 2014 11:52 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Problem capturing text using DOM in IE 11

With Jaws 15
IE 11
This will pop the whole page text in a message box.

Script Test ()
Var
     Object HTML,
     String sText

     Let HTML = IEGetCurrentDocument ()
     Let sText = HTML.body.innerText

     MessageBox (sText)

EndScript

Does that help at all?

Bob


On 12/12/2014 16:28, John Robichaud wrote:
> Bob & Scott,
> I've tried both of your suggestions without success. The situation is 
> critical now as an individuals employment counts on resolving this.
> I've done some more experimenting and have discovered the following.
> When using Internet Explorer 8 under Windows 7 with either Jaws 13 or
> 15 the code I've reposted below successfully captures the text on a 
> web page.  For this test I've used Freedom Scientifics home page but 
> the web page doesn't seem to be significant.
> With either IE 9 or IE 11 the code returns nothing.  I've been unable 
> to come up with any script code that can use the DOM to access text in 
> IE 9 or IE 11.  Can use of the DOM be broken in Jaws as regards newer 
> versions of IE?  If so, that's a very serious problem.
> I'm deperate at this point - if anyone can demonstrate Jaws code that 
> successfully uses the DOM to access text in IE 9 or 11 please post it.
> My code that works in IE 8 follows:
>
> String Function WorkSpaceText ()
> var
>       object doc,
>       object win,
>       string sBuffer
>
>       Let doc = ieGetCurrentDocument ()
>       Let win = ieGetUnrestrictedWindow(doc).document.body
>       Let sBuffer = win.createTextRange().text
>               return sBuffer
> EndFunction
>
> John Robichaud
>
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx 
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Scott Huey 
> (Redacted sender "smartinhuey@xxxxxxxxx" for DMARC)
> Sent: Wednesday, December 10, 2014 3:48 PM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Problem capturing text using DOM in IE 11
>
> The one thing I can tell you about DOM manipulation techniques within 
> JAWS scripts is that JAWS absolutely hates chaining the object methods 
> more than one layer deep. In a number of instances, I've found that 
> while the chain is conceptually sound, the function only works if I 
> walked the individual calls into variables. Example from below, 
> "oFrame.document.body.innerText" is a valid call in JavaScript, but in 
> JAWS script you may find it only works if you do it like this:
>   
> let oDOM = ieGetCurrentDocument ()
> let oFrame = oDOM.frames(2)
> let oObject = oFrame.document
> let oObject = oObject.body
> let sText = oObject.innerText
>
>
>
>
> --------------------------------------------
> On Wed, 12/10/14, Bob <temp@xxxxxxxxxxxxxxx> wrote:
>
>   Subject: [jawsscripts] Re: Problem capturing text using DOM in IE 11
>   To: jawsscripts@xxxxxxxxxxxxx
>   Date: Wednesday, December 10, 2014, 3:03 PM
>   
>   John
>   
>   I have no idea what the difference is but I
>   have always used
>   IeGetCurrentDocument when
>   playing with the DOM.
>   I would try something
>   like the following:
>   
>   String
>   Function GetFrameContents ()
>   Var
>       Object oDOM,
>      
>   Object oFrame,
>       String sFrameText
>   
>       Let oDOM =
>   ieGetCurrentDocuemnt ()
>       Let oFrame =
>   oDOM.frames(2)
>       
>       Let sFrameText =
>   oFrame.document.body.innerText
>   
>       Return sFrameText
>   
>   EndFunction
>   
>   You may need to fiddle with the document.body.
>   and the innerText to maybe
>   innerHTML or
>   outerText dependant on what sort of output you need.
>   You also need to take into account the origin
>   of the frame contents. To
>   increase security
>   modern browsers prevent scripts from running from a
>   different domain. If the frame contents are
>   from http://siteA.com and the
>   main page is http://siteB.com
>   you wont be able to access it.
>   
>   Hope this helps.
>   
>   Bob
>   
>       
>   
>   -----Original Message-----
>   From: jawsscripts-bounce@xxxxxxxxxxxxx
>   [mailto:jawsscripts-bounce@xxxxxxxxxxxxx]
>   On Behalf Of John Robichaud
>   Sent: 09
>   December 2014 21:06
>   To: JawScripts
>   Subject: [jawsscripts] Problem capturing text
>   using DOM in IE 11
>   
>   I'm
>   having a problem capturing text from an HTML frame using the
>   DOM in IE
>   11.  This is Windows 7 and Jaws
>   15.
>   The following code works with IE8 and
>   Jaws 13 but not with IE 11 and Jaws
>   15:
>   
>    
>   
>   String Function WorkAreaText ()
>   
>   var
>   
>        object doc,
>   
>        object
>   TopWindow,
>   
>    
>      object win,
>   
>        object frames,
>   
>        string
>   sBuffer
>   
>    
>   
>        Let doc =
>   ie4GetCurrentDocument ()
>   
>    
>      Let topWindow = doc.parentWindow
>   
>        Let topWindow
>   = topWindow.top
>   
>    
>      Let frames = TopWindow.frames
>   
>        Let win =
>   ieGetUnrestrictedWindow(frames(2)).document.body
>   
>        Let sBuffer =
>   win.createTextRange().text
>   
>                    
>      return sBuffer    ;the text in the frame
>   
>   EndFunction
>   
>    
>   
>    
>   
>   I'd
>   appreciate any suggestions.
>   
>   Also can anyone explain the difference between
>   ie4GetCurrentDocument ()and
>   ieGetCurrentDocument ().
>   
>   Although I've successfully used the
>   function ieGetUnrestrictedWindow() many
>   times in the manner shown above I've never
>   seen a good explanation of it.
>   Can anyone
>   explain it?
>   
>   John
>   Robichaud
>   
>    
>   
>   
>   
>   __________�
>   
>   View the list's information and change your
>   settings at
>   //www.freelists.org/list/jawsscripts
>   
>   
>   __________�
>   
>   View the
>   list's information and change your settings at
>   //www.freelists.org/list/jawsscripts
>   
>   
> __________�
>
> View the list's information and change your settings at 
> //www.freelists.org/list/jawsscripts
>
> __________�
>
> View the list's information and change your settings at 
> //www.freelists.org/list/jawsscripts
>

__________�

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts

__________�

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts


__________�

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts

__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: