[wtr-general] Re: Save Download Box behaves differently on IE 6 and IE 7

2010-07-01 Thread joedio
Asheesh,


I see from the code you supplied that when running with IE6 you
are passing to AutoIt one title as a variable...
  window_title = "File Download"
  ai.WinWaitActive(window_title,prompt_message,1)

have another title hard coded as "Save As"
ai.WinWait("Save As", "Save &in", 5)

and another window's title hard coded as "Download complete"
ai.ControlClick("Download complete", "", "Close")

Have you manually verified that the titles of each those windows are
exactly the
same when opened via IE6 and IE7?

If they are not identical then you can either add if/then statements,
or perhaps use
regular expressions to identify the windows in a manner that matches
both
IE6 and IE7 titles, to account for that difference.

Joe



On Jul 1, 10:34 am, asheesh misra  wrote:
> Hi All,
>
> I am newbie in Ruby/ WATIR and am struggling for the past 4 days with a
> slightly uncommon problem.
>
> The application I am trying to automate has a feature of exporting the data
> table in .csv format.
>
> I use following function to save that exported .csv file:
>
> def SaveFileCorrectOne(filepath)
> ai = WIN32OLE::new('AutoItX3.Control')
> prompt_message = "Do you want to open or save this file?"
> window_title = "File Download"
> sleep 5
> ai.WinWaitActive(window_title,prompt_message,1)
> ai.ControlFocus(window_title, prompt_message, "&Save")
> ai.ControlClick(window_title,prompt_message,4427)
> ai.WinWaitActive("Save As","Save &in",2)
> ai.ControlSetText("Save As","Save &in",1148,filepath)
> ai.ControlClick(window_title,prompt_message,"&Save")
> ai.WinWait("Save As", "Save &in", 5)
> ai.ControlClick("Save As", "Save &in","&Save")
> ai.WinActivate("Save As","")
> ai.ControlFocus("Save As", "", "&Yes")
>     ai.ControlClick("Save As", "", "&Yes","left")
>     ai.WinWait("Download complete", "", 1)
>     ai.ControlClick("Download complete", "", "Close")
> end
>
> On IE 6, when this function is executed, the export process proceeds in the
> following manner:
> 1. Export Button is clicked.
> 2. Save As dialog box appears (and behind this dialog box appears a blank IE
> window.)
> 3. On saving the file (.csv file), the 'Download Complete' box is visible
> (and in the background the blank IE window is also visible).
> 4. On clicking the 'Close' button on the 'Download Complete' box, the box
> closes but the window doesn't close, and this hangs the script.
>
> On IE7, when the Export button is clicked, an IE window flashes and
> disappears, and the script moves ahead to the next task. The export of the
> .csv file doesn't take place. In other words, the SaveFile function never
> gets called.
>
> Can anyone please, please help me.
>
> Regards,
>
> Asheesh

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Save Download Box behaves differently on IE 6 and IE 7

2010-07-01 Thread asheesh misra
Hi All,

I am newbie in Ruby/ WATIR and am struggling for the past 4 days with a
slightly uncommon problem.

The application I am trying to automate has a feature of exporting the data
table in .csv format.

I use following function to save that exported .csv file:

def SaveFileCorrectOne(filepath)
ai = WIN32OLE::new('AutoItX3.Control')
prompt_message = "Do you want to open or save this file?"
window_title = "File Download"
sleep 5
ai.WinWaitActive(window_title,prompt_message,1)
ai.ControlFocus(window_title, prompt_message, "&Save")
ai.ControlClick(window_title,prompt_message,4427)
ai.WinWaitActive("Save As","Save &in",2)
ai.ControlSetText("Save As","Save &in",1148,filepath)
ai.ControlClick(window_title,prompt_message,"&Save")
ai.WinWait("Save As", "Save &in", 5)
ai.ControlClick("Save As", "Save &in","&Save")
ai.WinActivate("Save As","")
ai.ControlFocus("Save As", "", "&Yes")
ai.ControlClick("Save As", "", "&Yes","left")
ai.WinWait("Download complete", "", 1)
ai.ControlClick("Download complete", "", "Close")
end


On IE 6, when this function is executed, the export process proceeds in the
following manner:
1. Export Button is clicked.
2. Save As dialog box appears (and behind this dialog box appears a blank IE
window.)
3. On saving the file (.csv file), the 'Download Complete' box is visible
(and in the background the blank IE window is also visible).
4. On clicking the 'Close' button on the 'Download Complete' box, the box
closes but the window doesn't close, and this hangs the script.

On IE7, when the Export button is clicked, an IE window flashes and
disappears, and the script moves ahead to the next task. The export of the
.csv file doesn't take place. In other words, the SaveFile function never
gets called.

Can anyone please, please help me.

Regards,

Asheesh

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Mouse_click method for firefox browser

2010-07-01 Thread joedio
Kiran,

You didn't mention what objects it works/fails with. Is it only
working for a particular type of object, and failing on another type
of object?

Is it possible that the reason Watir's click() method does not work
for your situation is that the java script for the objects you are
trying
to access contain different trigger events (e.g. one requires
onChange,
another requires onFocus), or multiple fire events are needed
to be performed in the proper sequence?

For example a text field may require:
   # 1. Perform a click method on the object
 browser.text_field(:how, what).click
   # 2. Perform  an onFocus fire event on the object
 browser.text_field(:how, what).fire_event("onFocus")
   # 3. Perform  a Set method on the object
 browser.text_field(:how, what).set("My Text")
   # 4. Perform  an onChange fire event on the object
browser.text_field(:how, what).fire_event("onChange")

Could that be the root of the issue you've encountered?

It could help if you would post a pared down sample of the HTML
code for a couple of the objects you are having issues with.

Joe

On Jul 1, 2:33 am, kiran yajamanyam  wrote:
> Hi Friends,
>
> I am facing a problem while clicking on few objects (both in IE and Firefox)
> for IE  I am using mouse_click() method which  I have taken from grup and is
> perfectly working fine and I have attached that piece of code in this mail.
> Did some one tried Mouse_click method for firewatir?
>
> I have struck up with this as I am unable to provide support for firefox for
> my project where as in IE I have quite a big number of test cases which I
> have automated(around 1000)
>
> Swift reply will be appreciated .
>
> PS: click() or click! or click_no_wait() or .fire_event("onClick") none of
> these methods are working for few elements in my project both in IE as well
> as Firefox. Objects on which click is not working are having javascript for
> events.
>
> Regards,
> Kiran Y
>
>  Mouse_click.rb
> 2KViewDownload

-- 
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: watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: Rich calender how to get value

2010-07-01 Thread Željko Filipin
Does this work?

ie.table(:id, "globalForm:startDateDecorate:startDate").cell(:text,
"30").click

Or this?

ie.cell(:text, "30").click

If it clicks the date, but nothing happens, you probably have to fire some
JS event.

Željko

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-01 Thread joedio
Shlomit,

This may work for your situation:

# Define the element ID to be acted upon
myID =  "your_id"

# Loop through the radio elements
browser.radios.each do | radio |

   # Separate the matching radios
   if(browser.radio(:id,  myID ))
  # Do whatever you need to do with it (e.g. set it)
  browser.radio(:id,  myID ).set
   end

end # End of Loop


Hope that helps,
Joe

On Jul 1, 5:08 am, Shlomit Gazit  wrote:
> I am trying to iterate through radio buttons in the page, but I dont
> want to iterate through all the radios in the page, only those with
> certain id.
> How can I do that?

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Rich calender how to get value

2010-07-01 Thread naresh
Hi,
I tried to select date  with following
ie.table(:id, "globalForm:startDateDecorate:startDate").link(:text,
"30").click
i got exception
 Unable to locate element, using :text, "30" unknownobjectexcception.

In IE dev toolbar HTML code is for rich-calender is like below












<<




<




July, 2010




>




>>




x












Sun


Mon


Tue


Wed


Thu


Fri


Sat




27


27


28


29


30


1


2


3




28


4


5


6


7


8


9


10




29


11


12


13


14


15


16


17




30


18


19


20


21


22


23


24




31


25


26


27


28


29


30


31




32


1


2


3


4


5


6


7









01-07-2010




Clean








Today

















On Jul 1, 4:04 pm, Željko Filipin 
wrote:
> On Thu, Jul 1, 2010 at 12:44 PM, naresh  wrote:
> > Can anyone tell me in below script , what is
> > monthLabels,weekDayLabels, are these cell or link in calender.
>
> Do you know that javascript can create HTML? Calendar that you want to
> automate is not visible in page source, it is visible in a tool like Firebug
> (Firefox) or IE dev toolbar (IE).
>
> Željko

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Iterate through radio buttons

2010-07-01 Thread Shlomit Gazit
I am trying to iterate through radio buttons in the page, but I dont
want to iterate through all the radios in the page, only those with
certain id.
How can I do that?

-- 
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: watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: Rich calender how to get value

2010-07-01 Thread Željko Filipin
On Thu, Jul 1, 2010 at 12:44 PM, naresh  wrote:
> Can anyone tell me in below script , what is
> monthLabels,weekDayLabels, are these cell or link in calender.

Do you know that javascript can create HTML? Calendar that you want to
automate is not visible in page source, it is visible in a tool like Firebug
(Firefox) or IE dev toolbar (IE).

Željko

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Rich calender how to get value

2010-07-01 Thread naresh
Hi ,

Can anyone tell me in below script , what is
monthLabels,weekDayLabels, are these cell or link in calender.
I am trying to select, Monday,March from calender.
I used 2 approach

ie.cell(:class => "rich-calendar-inputrich-calendar-button",:text=>/
Monday.*March/).click;

ie.table(:id,
"globalForm:startDateDecorate:startDate").link(:weekDayLabels,
"Monady").link(:monthLabels, "March").click

I am getting exception unable to locate object.




Start
Date:
 


new
Calendar('globalForm:startDateDecorate:startDate', {dayListTableId:
'globalForm:startDateDecorate:startDateDay',
weekNumberBarId:
'globalForm:startDateDecorate:startDateWeekNum',
weekDayBarId:
'globalForm:startDateDecorate:startDateWeekDay',
currentDate: new Date(2010,5,25),
selectedDate: null,
datePattern: 'dd-MM-',
jointPoint: 'bottom-left',
direction: 'bottom-right',
boundaryDatesMode:'inactive',
popup: true,
enableManualInput: true,
showInput: true,
disabled: false,
readonly: false,
ajaxSingle: true,
verticalOffset:0,
horizontalOffset: 0,
style:'z-index: 3; ',
firstWeekDay: 0,
minDaysInFirstWeek: 1,
todayControlMode:'select',
showHeader:true,
showFooter:true,
showWeeksBar:true,
showWeekDaysBar:true,
showApplyButton:false,
resetTimeOnDateSelect:false,
defaultTime:{hours:12,minutes:0},
 labels:{apply:'Apply', today:'Today', clean:'Clean',
cancel:'Cancel',
ok:'OK', close:'x'},
'monthLabels':
['January','February','March','April','May','June','July','August','September','October','November','December']
 ,
'monthLabelsShort':
['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] ,
'weekDayLabels':
['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] ,
'weekDayLabelsShort':
['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] }).load();

 
 






On Jul 1, 3:16 pm, Željko Filipin 
wrote:
> On Thu, Jul 1, 2010 at 12:03 PM, naresh  wrote:
> > ie.cell(:class => " rich-calendar-input rich-calendar-
> > button",:text=>"Monday",:text=>"March").click;
>
> Several problems:
>
> - leading space in " rich-calendar..."
> - you are saying that there is cell with exactly text "Monday" and "March" -
> a cell can have exactly one of two strings, not both
> - if both texts should be in the same cell, try this
>
> ie.cell(:class => "rich-calendar-input
> rich-calendar-button",:text=>/Monday.*March/).click;
>
> Željko

-- 
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: watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: Rich calender how to get value

2010-07-01 Thread Željko Filipin
On Thu, Jul 1, 2010 at 12:03 PM, naresh  wrote:
> ie.cell(:class => " rich-calendar-input rich-calendar-
> button",:text=>"Monday",:text=>"March").click;

Several problems:

- leading space in " rich-calendar..."
- you are saying that there is cell with exactly text "Monday" and "March" -
a cell can have exactly one of two strings, not both
- if both texts should be in the same cell, try this

ie.cell(:class => "rich-calendar-input
rich-calendar-button",:text=>/Monday.*March/).click;

Željko

-- 
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: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Rich calender how to get value

2010-07-01 Thread naresh
Hi,


I am using  below line to click date in calender

ie.cell(:class => " rich-calendar-input rich-calendar-
button",:text=>"Monday",:text=>"March").click;

but i am getting exception.



c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:56:in
`assert_ex
ists': Unable to locate element, using {:class=>" rich-calendar-input
rich-calen
dar-button", :text=>"March"}
(Watir::Exception::UnknownObjectException)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/
element.rb:288
:in `enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/
element.rb:60:
in `assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/
element.rb:233
:in `click!'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/
element.rb:219
:in `click'
from Event-Insert-play.rb:21





On Jun 30, 11:04 pm, Chuck van der Linden  wrote:
> You have to ask yourself how much value you provide to your project by
> testing some third party tool beyond it's being integrated properly
> into your product.
>
> If it was me, I'd look for the most expedient way to get the value I
> needed 'set'   If the calendar has an input box that accepts my typing
> into it, then doing something similar to that in your tests might be
> the best route.  As always with any tool that drives the browser
> (Watir, Selenium, etc) you look at 'what do I do manually to control
> this thing?' and then basically find ways to simulate that using the
> automation code.   If it LETS you just click in a given spot and input
> a value, then that's what I'd try to automate in most of my cases
> (beyond one basic test that the calendar works when you pick the date
> that way)
>
> But some of these tools, the ONLY way to get the date into the field
> is by 'picking' it from the calendar, and there is no 'manual entry'
> option that lets you 'type' in a value.  So you are stuck automating
> the clicking on specific cells in the calendar.  To do that you need
> to write a script that's going to work a month or a year from now, so
> you'll need to go throught the motions of clicking in the portion (a
> sub table in the example I looked at) of the control that lets you
> pick the year and month, Then picking the year and month, THEN picking
> the day of the month.  Otherwise a day from now you'll be clicking on
> July 30 instead of June 30
>
> Based on the sample I looked at, almost all of those are going to
> be .cell elements, and hopefully just doing a 'click' on the element
> will work for what you need.
>
> On Jun 30, 5:51 am, Wesley Chen  wrote:
>
> > If you are not sure what you want to do, please try the cases you have.
>
> > Wesley.
> > For life, the easier, the better.
>
> > On Wed, Jun 30, 2010 at 1:38 PM, naresh  wrote:
> > > Hi,
>
> > > I am confused in rich calender, i need to click image and then get
> > > elements or
> > > do like following
>
> > > ie.cell(:class => "j_id354_j_id355DayCell rich-calendar-cell rich-
> > > calendar-btn", :text => "16").click  which Linden suggested.
>
> > > I am confused class, there is 2 classes in HTML code.
> > > class="rich-calendar-input "
> > > class="rich-calendar-button"
> > > which one to use.
> > > My requirement to select a 30-jun-2010 date from calender.
>
> > > Regards,
> > > Naresh
>
> > > On Jun 29, 8:32 pm, Chuck van der Linden  wrote:
> > > > If it's the same as the sample that was linked early in the thread,
> > > > when this control is rendered in the UI, it is a series of table
> > > > cells, and each cell is 'wired' for a number of events.   You may need
> > > > to experiment with what events are fired in what order, I'd start
> > > > however with trying the following
>
> > > > What you are looking at is structured around a table, and each date is
> > > > a cell.  Because some dates appear more than once you cannot reliably
> > > > identify by the cell text alone, and will need to use some other means
> > > > to identify the 'right' type of cell that has the right text.   The ID
> > > > is completely positional within the grid, meaning that it's
> > > > relationship to the date will be different each month (7
> > > > possibilties).  that makes using ID to get the right cell a total
> > > > pain.  This would seem to make the best option to utilize the CLASS of
> > > > the cell, since the controll uses a small set of potential classes
> > > > (borders, holidays, workdays)    So using Class along with Text might
> > > > be your best bet, presuming of course that you want to pick a date in
> > > > the current month of the current year etc.  (otherwise you are going
> > > > to need to first click in the navigation cell, part of an inner table,
> > > > that lets you pick month and year.  OTOH since those values are
> > > > unique, you should be able to select them by cell text alone.
>
> > > > ..  So it will depend on if you test uses some date relative to
> > > > 'today' or is always picking the same date.  Relative to Today is
> > > >

[wtr-general] Mouse_click method for firefox browser

2010-07-01 Thread kiran yajamanyam
Hi Friends,

I am facing a problem while clicking on few objects (both in IE and Firefox)
for IE  I am using mouse_click() method which  I have taken from grup and is
perfectly working fine and I have attached that piece of code in this mail.
Did some one tried Mouse_click method for firewatir?

I have struck up with this as I am unable to provide support for firefox for
my project where as in IE I have quite a big number of test cases which I
have automated(around 1000)


Swift reply will be appreciated .


PS: click() or click! or click_no_wait() or .fire_event("onClick") none of
these methods are working for few elements in my project both in IE as well
as Firefox. Objects on which click is not working are having javascript for
events.


Regards,
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
To unsubscribe: watir-general+unsubscr...@googlegroups.com


Mouse_click.rb
Description: Binary data


[wtr-general] Fwd: Donate to Watir

2010-07-01 Thread Željko Filipin
If you like the Watir project, you can make a donation. There is donate
button at http://watir.com/.

We have raised $595 this year. We will spend it on hosting and stuff like
that.

You can see list of donors and Bret's thank you note at
http://pledgie.com/campaigns/2982

Željko

-- 
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: watir-general+unsubscr...@googlegroups.com