I tried the code with system() command and following might be the reason it
is not working:

When you try to open firefox using system command it returns when firefox
shows up. But it doesn't wait for the default page to be loaded (which is
google.com) so it is not able to find the window with that title.

Workarounds:
1. put sleep after system() so that your page gets loaded and then try the
code
require 'firewatir'

system("d:\\installations\\Firefox\\firefox.exe -jssh")
sleep(5)
$ie = FireWatir::Firefox.attach(:title,"Google")
$ie.goto("google.com")
puts $ie.title

2. set the default page to blank
require 'firewatir'
system("d:\\installations\\Firefox\\firefox.exe -jssh")
$ie = FireWatir::Firefox.attach(:title,"")
$ie.goto("google.com")
puts $ie.title

Both the code worked for me with Firewatir 1.6.2 on windows XP SP2

- Angrez

On Wed, Apr 15, 2009 at 1:11 AM, Moochie <dduph...@redbrickhealth.com>wrote:

>
> #open first occurance of FF
> $ie = Firefox.new :attach => true
> #Navigate it to cnn.com
> $ie.goto "cnn.com"
> #This now works (Doesn't Hang)
> system("C:\\Program Files\\Mozilla Firefox\\firefox.exe -
> jssh")
> #This still fails
> $ie = FireWatir::Firefox.attach(:title,"Google")
> puts $ie.title
>
> Any suggestions?
>
>
>
> On Apr 13, 3:21 pm, bwaybandit <lenridge...@gmail.com> wrote:
> > also on XP/SP2
> >
> > On Apr 13, 3:55 pm, bwaybandit <lenridge...@gmail.com> wrote:
> >
> >
> >
> > > ff - 3.0.5
> > > jssh - 0.9
> >
> > > On Apr 13, 3:31 pm, "Darin Duphorn" <dduph...@redbrickhealth.com>
> > > wrote:
> >
> > > > What version of FF are you using?
> >
> > > > Even if I run from irb using system or exec it hangs.
> >
> > > > -----Original Message-----
> > > > From: watir-general@googlegroups.com [mailto:
> watir-gene...@googlegroups.com] On Behalf Of bwaybandit
> > > > Sent: Monday, April 13, 2009 12:42 PM
> > > > To: Watir General
> > > > Subject: [wtr-general] Re: firewatir and jssh
> >
> > > > system("C:\\Program Files\\MozillaFirefox\\firefox.exe -jssh"). that
> > > > works for me. If that is not working for you, you might want to try
> > > > exec BUT having said that, watch out because exec overwrites the
> > > > existing process, so if you are calling it from another process, your
> > > > originial process will hang.
> >
> > > > all my test machines are set up using a perl script and one of the
> > > > setup processes launches FF. The system command I tried above was
> from
> > > > irb and it came back and nothing hung.
> >
> > > > On Apr 13, 12:31 pm, "Darin Duphorn" <dduph...@redbrickhealth.com>
> > > > wrote:
> > > > > Actually, when I try to run it for the systems it hangs.
> >
> > > > > How are you launching the jssh?
> >
> > > > > -----Original Message-----
> > > > > From: watir-general@googlegroups.com [mailto:
> watir-gene...@googlegroups.com] On Behalf Of bwaybandit
> > > > > Sent: Monday, April 13, 2009 11:18 AM
> > > > > To: Watir General
> > > > > Subject: [wtr-general] Re: firewatir and jssh
> >
> > > > > If you use the system command and launchfirefoxlike that, that will
> > > > > load jssh
> >
> > > > > Now that you have jssh in memory, you need to launch the page you
> want
> > > > > toattachto.
> >
> > > > > 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 theattachstill fails.
> >
> > > > > > system('C:\Program Files\MozillaFirefox\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 theattachmethod 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 existingFirefoxinstance 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 toattachto 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
> > > > > > > >Firefoxclass 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*- Hide quoted text -
> >
> > - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
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