[wtr-general] waitr - problem with autoit WinActivate - fails at random

2010-01-12 Thread Alpinweis
I am using the following code taken from Watir Wiki on JS Popups:

def check_for_popups(title=Windows Internet Explorer,
button=OK, user_input=nil)
  popup = Thread.new {
autoit = WIN32OLE.new('AutoItX3.Control')
ret = autoit.WinWait(title,,60)
if (ret == 1)
  puts Popup
  autoit.WinActivate(title)
  puts after WinActivate
  button.downcase!
  if button.eql?('ok') || button.eql?('yes') || button.eql?
('continue') || button.eql?('open') || button.eql?('allow')
autoit.Send(user_input) if user_input
autoit.Send({Enter})
  else
autoit.Send({tab})
autoit.Send({tab}) if title == 'Open'
autoit.Send({Enter})
  end
elsif (ret == 0)
  puts Popup failed to show up
end
  }
  at_exit { Thread.kill(popup) }
end

I am using it with click_no_wait. My problem is that
autoit.WinActivate often fails (looks like at random) when checking
for a 'File Open' popup with a text field for the filename. It never
succeeds on the first run, might succeed on the second or third try.
It does not seem to fail when checking for a simple  javasrcipt
confirmation popup.

I am running on Windows 7 x64, watir 1.6.5, ruby oneclick installer
1.8.6-27 with the patch for click_no_wait applied, original
AutoItX3.dll registered (downloaded from AutoIt website, since the one
included with watir 1.6.5 does not work for me). There is also an
AutoItX3_x64.dll. I tried to rename it to AutoItX3.dll and register it
but this did not help.

Would appreciate any help on how to fix this.
-- 
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

[wtr-general] Verify table sort order

2010-01-12 Thread Hamid
I wonder if anyone can help me to change the cod so it will also sort
a empty table (nil)?
BR/Hamid


 # Verify the sort order of a table.
  # * first_row: The number if the first row in the table
  # * last_row: The number if the last row in the table
  # * column: The column number to verify order in.
  # * order: The order to check (asc, desc)
  def verifyTableSortOrder(first_row, last_row, column, order)

current_row = first_row
last_value = nil

# Get first value and put into last_value
while(current_row = last_row  (!last_value ||
last_value=='NA'))
  last_value = self.getValueInTable(current_row, column)
  current_row += 1
end

if(last_value[/http:/]) # URL(images) should be sorted first
  last_value = ' ' # First char in ascii sort order
elsif(is_time = self.parseTime(last_value))
  last_value = is_time
elsif(numeric?(last_value))
  last_value = last_value.to_f
else
  last_value = last_value.downcase
end

success = true
while(current_row = last_row)
  current_value = self.getValueInTable(current_row, column, 1)

  if(!current_value || current_value == 'NA')
# No comparison
current_row += 1
next
  elsif(current_value[/http:/]) # URL(images) should be sorted
first
# URL comparison
current_value = ' ' # First char in ascii sort order
  elsif(is_time)
# Time comparison
current_value = self.parseTime(current_value)
  elsif(numeric?(current_value)  last_value.class==Float)
# Numeric comparison
current_value = current_value.to_f
  else
# String comparison
current_value = current_value.downcase()
last_value = last_value.to_s
  end

  if(order[/asc/i])
unless(current_value=last_value)
  self.failure(Column #{column} was not sorted Ascending. #
{current_value}  #{last_value})
  success = false
end
  elsif(order[/desc/i])
unless(current_value=last_value)
  self.failure(Column #{column} was not sorted Descending. #
{current_value}  #{last_value})
  success = false
end
  end
  last_value = current_value
  current_row += 1
end
if(success)
  self.success(Column #{column} was sorted #{order})
end
  end
-- 
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

Re: [wtr-general] Not able to edit Text Field

2010-01-12 Thread karim rayani
use the innerText property or innerHTML propertry, some java script
knowledge will be helpful

Thanx

Karim Rayani

On Mon, Jan 11, 2010 at 4:46 PM, lokesh.agra...@gmail.com 
lokesh.agra...@gmail.com wrote:

 Hi Guys,

 I am facing one problem.
 In my webpage I have table which has many TD/TR and Div

 Sample code

 TD class=edittable-cellDIV class=editable-textbinding 
 style=WIDTH: autolokesh/DIV/TD

 Now, this Div is actually a text field where lokesh is written and I
 want to change it.

 I am able to find the div
 ie.table(:id, ivr_template:params).div(:index,1).flash

 even I am able to get the text
 ie.table(:id, ivr_template:params).div(:index,1).text = lokesh or
 ie.table(:id, ivr_template:params)[2][2].text

 but I am not able to change this. As set method is not supported by
 div or table

 Can anyone give me solutions?

 Thanks in Advance


 Regards,
 Lokesh Agrawal

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

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

Re: [wtr-general] Re: No Matching Window Exception.

2010-01-12 Thread Krishna saradka
Try printing the URL of the loaded page, just to confirm that the page still
has the same URL and is not changed on page load. You may print the URL soon
after the page load to confirm this.

urlNew  = $ie.url
puts  URL confirmation : +urlNew
$ie = Watir::IE.attach(:url, urlNew)


add them before the code
$ie = Watir::IE.attach(:url, test_site)

Thanks  Regards,
KK

On Tue, Jan 12, 2010 at 3:50 PM, Chandu80 chandu.she...@gmail.com wrote:

 Hi,
 I have checked and found the browser url as http://www.google.com.

 Regards
 Chandrika

 On Jan 11, 7:49 pm, Željko Filipin zeljko.fili...@wa-research.ch
 wrote:
  Did you check that browser url is google.com? When I navigate to
 google.com,
  it actually opens google.hr (because I am in Croatia)?
 
  Željko

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

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

[wtr-general] Reading HTML objects CSS properties in Firefox

2010-01-12 Thread basu
Hi,
For IE , i can retrieve CSS properties of a HTML object say link as
link.document.CurrentStyle.color , is there any way to read CSS
properties in Firefox?

Thanks
- Basu
-- 
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

[wtr-general] Re: Watir - Going down a to read the next element and perform click action on a button

2010-01-12 Thread tester86
HI

With the app there is an id association but sproutcore considers
everything as a link and you have to use onmousedown and onmouseup in
order to select a checkbox. When I use that with watir it does not
click on the second link it just unchecks the first link. If you have
any ideas for suggestions that would be great.

Thanks

On Jan 11, 3:00 pm, Charley Baker charley.ba...@gmail.com wrote:
 Watir supports anything that's part of the dom. I don't know sproutcore, but
 any JS libraries are fine. ID association is great and if you can enforce
 unique ids, it'll make testing easier.

 -c



 On Mon, Jan 11, 2010 at 1:51 PM, tester86 sagar.am...@gmail.com wrote:
  Hi

  I maybe starting another thread but thought I'd post my message on
  here. How does Watir support Javascript (sproutcore). For example if I
  wanted to click on a checkbox sproutcore considers it as a link which
  has an ID assoication.

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

[wtr-general] watir cheat sheet

2010-01-12 Thread marekj
http://cheat.errtheblog.com/s/watir

or from your terminal window type

$ gem install cheat #= this will install a cheat gem (if you are
behind firewall set your HTTP_PROXY=http://host:port)
$ cheat watir #= this will display the cheat sheet in your terminal


marekj

Watirloo: Semantic Page Objects in UseCases
http://github.com/marekj/watirloo/
Support Watir Project http://pledgie.com/campaigns/2982
-- 
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