[Wtr-development] [JIRA] Updated: (WTR-221) Get the text from a frame [patch]

Charley Baker (JIRA) watirjira at gmail.com
Wed Oct 27 15:42:26 EDT 2010


     [ http://jira.openqa.org/browse/WTR-221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charley Baker updated WTR-221:
------------------------------

    Fix Version/s:     (was: 1.6.7)
                   Soon

> Get the text from a frame [patch]
> ---------------------------------
>
>                 Key: WTR-221
>                 URL: http://jira.openqa.org/browse/WTR-221
>             Project: Watir
>          Issue Type: New Feature
>          Components: FireWatir
>    Affects Versions: 1.6.7
>            Reporter: Bret Pettichord
>            Priority: Major
>             Fix For: Soon
>
>
> Paul Rogers on the firewatir list:
> try this
> class Frame
>     def url
>         locate
>         jssh_socket.send("#{DOCUMENT_VAR}.URL;\n", 0)
>         window_url = read_socket()
>         return window_url
>     end
>     def text
>         assert_exists
>         get_frame_text
>     end
> end
> class Element
>      def get_frame_text
>            jssh_socket.send("var htmlelem =
> #{DOCUMENT_VAR}.getElementsByTagName('html')[0]; htmlelem.textContent;
> \n", 0)
>            result = read_socket()
>            return result
>         end
> end
> jst add these lines after your require 'firewatir' line
> Paul
> On May 26, 6:58 am, MarioRuiz <ma... at betware.com> wrote:
> > > A full example:
> > >
> > > require 'firewatir'
> > > require 'watir'
> > > ie=Watir::IE.new()
> > > ff=FireWatir::Firefox.new()
> > > url="http://www.tlwilliams.net/NOCCC/0005/0005pFrame.html"
> > > frame="menu"
> > >
> > > ff.goto(url)
> > > ie.goto(url)
> > >
> > > puts "************************ FIREFOX *************************"
> > > myframe=ff.frame(frame)
> > > puts myframe.text()
> > >
> > > puts "************************ INTERNET EXPLORER
> > > *************************"
> > > myframe=ie.frame(frame)
> > > puts myframe.text()
> > >
> > > ff.close()
> > > ie.close()
> > >
> > > The result is:
> > >
> > > Starting Firefox using the executable : C:\Program Files\Mozilla
> > > Firefox\firefox.exe
> > > Waiting for 2 seconds for Firefox to get started.
> > > ************************ FIREFOX *************************
> > >
> > > ************************ INTERNET EXPLORER *************************
> > > Web Publishing - Using Frames in HTMLFrames
> > >
> > > __5.0_Introduction_to_Frames
> > >
> > > __5.1_Using_Frames
> > >
> > > __5.2_Complex_Frames
> > >
> > > __5.3_Floating_Frames
> > >
> > > __5.4_References
> > >
> > > As you can see we don't have any text content from firewatir.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the Wtr-development mailing list