If you use the system command and launch firefox like that, that will
load jssh

Now that you have jssh in memory, you need to launch the page you want
to attach to.

require 'watir'
Watir.options[:browser]='firefox'
ff=Watir::Browser.new
ff.goto 'http://www.google.com'

(You already have a reference to the page in 'ff')

If you want another reference to the same page, you would say:
ff1=ff.attach(:title, /something in the title/)

Now you have a second reference to the page...

On Apr 13, 11:30 am, "Darin Duphorn" <dduph...@redbrickhealth.com>
wrote:
> How do dou start Jssh?
>
> I've tried the below, but the attach still fails.
>
> system('C:\Program Files\Mozilla Firefox\firefox.exe -jssh')        
>
> $ie = FireWatir::Firefox.attach(:title,"Google")
>
> Thanks,
>
> ________________________________
>
> From: watir-general@googlegroups.com
> [mailto:watir-gene...@googlegroups.com] On Behalf Of Angrez Singh
> Sent: Monday, April 13, 2009 5:55 AM
> To: watir-general@googlegroups.com
> Subject: [wtr-general] Re: firewatir and jssh
>
> I tried the following code with Firewatir 1.6.2 and it worked for me.
>
> require 'firewatir'
>
> ff = FireWatir::Firefox.attach(:title,"Google")
>
> puts ff.html
> ff.close
>
> - Angrez
>
> On Mon, Apr 13, 2009 at 1:31 PM, George <george.sand...@gmail.com>
> wrote:
>
> It was my understanding that the attach method doesn't work with FF,
> only with IE.  Can you confirm this?
>
> On Apr 13, 12:07 am, Angrez Singh <ang...@gmail.com> wrote:
>
>
>
> > For attaching to an existing Firefox instance you can use
> > FireWatir::Firefox.attach() method. But you need to make sure the JSSh
> is
> > running in the existing instance.
>
> > Regarding XPath i'll look into it & get back to you.
>
> > - Angrez
>
> > On Fri, Apr 10, 2009 at 8:42 PM, Jeremy Mordkoff <j...@zeevee.com>
> wrote:
> > >  Okay, I answered some of my own questions. I stumbled on the RDOC
> > > browser, found js_eval and I started munging it.
>
> > > In firebug, I can do
>
> > > var results = document.evaluate("//*[name()='vgtile' and
> @label='Hulu']",
> > > document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
>
> > > if (results.snapshotLength >=
> > > 1)
>
> > > {
>
> > >     results.snapshotItem(0).oncommand();
>
> > > }
>
> > > console.log("done")
>
> > > and it works every time. But in firewatir, if I do
>
> > > xpath="//*[name()='vgtile' and @label='Hulu']"
>
> > > query = "browser=window.getBrowser();
>
> document.evaluate(\"#{xpath}\",
>
> > > document, null, 7, null).snapshotLength;"
>
> > > ff.js_eval(query)
>
> > > I get zero every time. Any ideas?  Is there a jssh forum?
>
> > > PS. The 7 is the value of XPathResult.ORDERED_NODE_SNAPSHOT_TYPE
> since
> > > XPathResult does not seem to be defined in jssh.
>
> > > JLM
>
> > > Hi all  --- no luck on my first issue, so I have taken a different
> > > approach. I have installed firebug and fireunit and I have the
> basics
> > > working in there. Now I want to move some of this over to firewatir.
>
> > > Is there a way to see all of the jssh interactions when running a
> firewatir
> > > script?
>
> > > Is there a way to send raw javascript commands to jssh (and capture
> the
> > > output) from a firewatir script?
>
> > > Is there a way to attach to an existing ff instance, rather than
> calling
> > > Firefox.new? I still feel like there must be one more doc around
> that I just
> > > can't find. Something that lists all of the methods and attributes
> of the
> > > Firefox class and the supporting classes. Or does ruby have some
> built in
> > > way to browse them?
>
> > > JLM
>
> > > * *
>
> > > *Jeremy Mordkoff*
>
> > > Director, QA, IT & Release
>
> > > *ZeeVee, Inc.*
>
> > > One Monarch Drive | Littleton, MA 01460
>
> > > Office: 978.467.1395 x233 | Fax: 978.467.1404
>
> > > Mobile: 978-257-2183
>
> > > *...@zeevee.com *
>
> > > *www.zeevee.com*
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to