Re: [wtr-general] Re: file download

2010-04-15 Thread arihan sinha
now I've changed the setting so that the powerpoint would be opened without
file download prompt.

now I need to focus on that already opened powerpoint and do some testing
through ruby.

earlier i was saving the powerpoint ( clicking the save button from that
file download prompt) and opening the same ppt as

 ppt = WIN32OLE.new('PowerPoint.Application')

ppt.Visible = true

   * **doc = ppt.Presentations.Open('C:\Documents and Settings\sinhaa\My
Documents\JHEPAT_2010_VOL51_PG845.ppt')*

slidecount = doc.Slides.Count
puts slidecount

but now as ppt already opened so rather than opening the ppt i should be
able to directly count the slides on that ppt.
i tried with below code but it seems not working. any thoughts???
ppt = WIN32OLE.new('PowerPoint.Application')

ppt.Visible = true

  slidecount = doc.Slides.Count

puts slidecount

Regards
Arihan

On Wed, Apr 14, 2010 at 2:11 PM, Jarmo Pertman jarm...@gmail.com wrote:

 Only workaround i've used so far is that i've used virtual machine so
 you can lock your main machine. No other solutions so far
 unfortunately.

 Jarmo

 On Apr 13, 5:50 pm, arihan sinha arihan.si...@googlemail.com wrote:
  Any solution to this problem. any work around etc.
 
  Regards
  Arihan
 
 
 
  On Fri, Apr 9, 2010 at 4:03 PM, Ethan notet...@gmail.com wrote:
   When the system is locked, windows doesn't send things like keypresses
 and
   button presses, as far as I've been able to determine. I know of no
   workaround for this, and would also be quite interested if anybody else
   knows one.
 
   On Fri, Apr 9, 2010 at 07:33, arihan sinha 
 arihan.si...@googlemail.comwrote:
 
   Hello All,
 
   To handle the download prompt I am using the below code as
 
   save_dialog = WIN32OLE.new(AutoItX3.Control)
   //
   ///
$ie.link(:text, Download images).click_no_wait
 
   click_link_text_no_wait(click Link Download images,
 Download
   images)
 
   save_dialog.WinWait(File Download,,20)
 
   save_dialog.WinActivate(File Download)
 
   #save_dialog.Send({TAB})
 
   save_dialog.Send({Enter})
 
   sleep 10.0
 
   This piece of code is working fine but when the system is locked then
 its
   not working.. any idea how to handle this.?
 
also in our remote build server when this piece of code is running
 and we
   just minimise that remote window then it stuck there and not moving
 further.
 
   Thanks
 
   Arihan
 
   --
   Before posting, please readhttp://watir.com/support. In short: search
   before you ask, be nice.
 
   You received this message because you are subscribed to
  http://groups.google.com/group/watir-general
   To post: watir-general@googlegroups.com
 
--
   Before posting, please readhttp://watir.com/support. In short: search
   before you ask, be nice.
 
   You received this message because you are subscribed to
  http://groups.google.com/group/watir-general
   To post: watir-general@googlegroups.com

 --
 Before posting, please read http://watir.com/support. In short: search
 before you ask, be nice.

 You received this message because you are subscribed to
 http://groups.google.com/group/watir-general
 To post: watir-general@googlegroups.com

 To unsubscribe, reply using remove me as the subject.


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com


[wtr-general] how ruby interacts with already opened powerpoint

2010-04-15 Thread arihan sinha
Hi,

In my application I've changed the setting so that the powerpoint would be
opened without file download prompt.

Now I need to focus on that already opened powerpoint and do some testing
through ruby.( say  count the no of slides)

earlier i was saving the powerpoint ( clicking the save button from that
file download prompt) and opening the same ppt as

 ppt = WIN32OLE.new('PowerPoint.Application')

ppt.Visible = true

   * **doc = ppt.Presentations.Open('C:\Documents and Settings\sinhaa\My
Documents\JHEPAT_2010_VOL51_PG845.ppt')*

slidecount = doc.Slides.Count
puts slidecount

but the problem happend that when the remote system ( build server) is
locked or minimised then it stuck in the file download prompt because it was
not sending the key stroke.

So after setting changed the ppt already opened so  i should be able to
directly count the slides on that ppt by focusing or activating the same
ppt.
i tried with below code but it seems not working. any thoughts???

$ie.goto(
http://www.thelancet.com/journals/lancet/article/PIIS0140-6736%2810%2960523-5/fulltext
)
 $ie.link(:text, Download to PowerPoint).click

###The ppt gets opened automatically as a separate ppt file without file
download prompt because settings changed.
ppt = WIN32OLE.new('PowerPoint.Application')

 ppt.Visible = true

 slidecount = * ppt.Presentations*.Slides.Count

puts slidecount

Regards

Arihan

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com

To unsubscribe, reply using remove me as the subject.


Re: [wtr-general] how ruby interacts with already opened powerpoint

2010-04-15 Thread Ethan
This group is about Watir, not WIN32OLE. I would look for microsoft's
documentation on what powerpoint exposes for OLE automation.
You will probably have to iterate over open applications to detect the
existing powerpoint window. You might look at the source of Watir::IE.each
(ie-class.rb, line 236) for an example of iterating over application
windows, though that is of course for IE windows and not powerpoint, and
you'd have to adapt it heavily to get what you need out of it.


On Thu, Apr 15, 2010 at 09:59, arihan sinha arihan.si...@googlemail.comwrote:

 Hi,

 In my application I've changed the setting so that the powerpoint would be
 opened without file download prompt.

 Now I need to focus on that already opened powerpoint and do some testing
 through ruby.( say  count the no of slides)

 earlier i was saving the powerpoint ( clicking the save button from that
 file download prompt) and opening the same ppt as

  ppt = WIN32OLE.new('PowerPoint.Application')

 ppt.Visible = true

* **doc = ppt.Presentations.Open('C:\Documents and
 Settings\sinhaa\My Documents\JHEPAT_2010_VOL51_PG845.ppt')*

 slidecount = doc.Slides.Count
 puts slidecount

 but the problem happend that when the remote system ( build server) is
 locked or minimised then it stuck in the file download prompt because it was
 not sending the key stroke.

 So after setting changed the ppt already opened so  i should be able to
 directly count the slides on that ppt by focusing or activating the same
 ppt.
 i tried with below code but it seems not working. any thoughts???

 $ie.goto(
 http://www.thelancet.com/journals/lancet/article/PIIS0140-6736%2810%2960523-5/fulltext
 )
  $ie.link(:text, Download to PowerPoint).click

 ###The ppt gets opened automatically as a separate ppt file without file
 download prompt because settings changed.
 ppt = WIN32OLE.new('PowerPoint.Application')

  ppt.Visible = true

  slidecount = * ppt.Presentations*.Slides.Count

 puts slidecount

 Regards

 Arihan

 --
 Before posting, please read http://watir.com/support. In short: search
 before you ask, be nice.

 You received this message because you are subscribed to
 http://groups.google.com/group/watir-general
 To post: watir-general@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com

To unsubscribe, reply using remove me as the subject.


[wtr-general] Re: watir exit code

2010-04-15 Thread Adam Reed
I can't say if the approach you're using is viable or not because I'm
not clear on your intended goal, but if you're trying to get just the
number after SystemExit try:

$variable = $variable.split(SystemExit)[1]

If I knew what test framework you were using, I could probably offer
an easier way to fail a test and send an email.  For test/unit:

begin
  assert_match(/testing/, @browser.text)
  (actions for PASS go here)
rescue = e
  (actions for FAIL/error go here)
end #begin

On Apr 14, 5:22 pm, Shlomit Gazit shlomitpatr...@gmail.com wrote:
 Somehow #{$!.class} prints as: SystemExit1 or SystemExit0, which is
 the opposite than what I see on the console in Irb: Exit code: 0,
 Error code: 1.
 In any case I need only the numbers 1 or 0 without the word
 SystemName, any idea?
 I wrote a script to send email if the test is failing.
 For now I am setting variable to 0 when initializing the test, and 1
 at the end of the test, if it is not failing, the variable is set to
 1.  But I prefer to not depends on that.

 On Apr 14, 2:00 pm, Ethan notet...@gmail.com wrote:

  as Charley said, watir does not exit, itself.
  If you want to know if an exception occurred causing your program to exit,
  you can check if the global exception variable, $! is set.
  at_exit do
    if $!
      print an exception occurred of type #{$!.class}
    end
  end
  or something along those lines.

  On Wed, Apr 14, 2010 at 16:36, Charley Baker charley.ba...@gmail.comwrote:

   Watir itself doesn't have an exit code, it's just a library. Are you
   talking about your own testing framework, rspec, test::unit? Those 
   generally
   can set exit codes. My question is what are you trying to do? Set it up 
   in a
   CI run? Something else entirely?

   -c

   On Wed, Apr 14, 2010 at 2:30 PM, Shlomit Gazit 
   shlomitpatr...@gmail.comwrote:

   Is there a method to use watir exit code (0 or 1)?
   I want to know that if it is 0 to do something at_exit.

   Thank you, Shlomit.

   --
   Before posting, please readhttp://watir.com/support. In short: search
   before you ask, be nice.

   You received this message because you are subscribed to
  http://groups.google.com/group/watir-general
   To post: watir-general@googlegroups.com

   To unsubscribe, reply using remove me as the subject.

    --
   Before posting, please readhttp://watir.com/support. In short: search
   before you ask, be nice.

   You received this message because you are subscribed to
  http://groups.google.com/group/watir-general
   To post: watir-general@googlegroups.com



-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com


[wtr-general] No method works for Frame

2010-04-15 Thread Kinnu

Hi Friends,

I am unable to identify elements inside a frame and no method of
element class is working(like exists?, click() etc). Following is the
current issue i am facing:

In my project, compose mail window is developed in frame and when I
copy a image inside compose body, folloing are the things I tryed and
nothing is working

1. puts ie.frame(edit_body).exists?()   gives error saying exists?()
is not a valid method for frame
2. puts ie.frame(edit_body).image(:title, TestPic.jpeg).exists?()
gives error saying exists?() is not a valid method for frame

Tried all combination's  but no luck. Is handling frames a drawback
for Watir itself? Is there soemthign that i should ask my developers
to enable ?

Will be great if some one who is also facing this problems let us know
solution if at all if any

Thanks,
Kiran Y

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com