[wtr-general] Re: How access tabs in Firefox?

2008-10-23 Thread al3kc

Michael Hwee  wrote:
 Did you try with object instance?

 ff = FireWatir::Firefox.new.attach(:title,/Title/)


This code works but still does not solve the problem :)

When I click a link the new page is opened in the same window in
ACTIVE tab. So I can click anything in this tab and I do not need to
attach it. But code  ff = FireWatir::Firefox.new.attach(:title,/
Title/) helps to verify that page is really open.
When I want to switch back to the previous page by this code I have an
error Unable to locate window, using url and http://link.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-23 Thread al3kc

Should this work for FireWatir? I tried to change it for
FireWatir::Element but it doesn't work.

Željko Filipin [EMAIL PROTECTED] wrote:
 On Mon, Sep 8, 2008 at 5:48 PM, Bret Pettichord [EMAIL PROTECTED] wrote:
  I think you need to require something before using this method. Any one?

 http://wiki.openqa.org/pages/viewpage.action?pageId=1119

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Ruby While Loop

2008-10-23 Thread jas . shelton

All,

I currently have a while loop that iterates as long as the cell it is
checking an Excel is not nil. I want to add a if statement in this
while loop that, if the 'if' condition is met, will add 1 to the loop
iterator, and restart the while loop, without executing the rest of
the code in the while loop.  Here is my code below:

while(input.Range(b#{x})['Value'] != nil)

if(input.Range(a#{x})['Value'] == 'no')
x +=1
end

Can someone please tell how to increment x and restart the while loop,
without executing the rest of the code in the while first?  I can
elaborate if this is not clear.  Thanks in advance for all of your
assistance.

- Shelton
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How to determine a container type from a variable assignment

2008-10-23 Thread niartseoj

Hello

I'm trying to find the method to run in order to determine if a
variarable is a container and if so what sort of container it is.

I'm doing this because i have to loop through a table, and identify if
there is a cell that contains a link with a matching name and a
certain type of image object.

  t = ie.table(:index,  7)  # since we
don't have ID's, look at every table
  for i in 1..t.row_count  # for every row in this
table
   t[i].each do |cell|# for every column in this
row, look at its contents
  if cell.text == _userid.to_s
  if cell.image(:src, /enabled/).exists?
$atag = cell.link(:index,1)
  end
 end
  end
  end

 puts $atag.control_type

In this code i need to handle if the $atag is set or if it is nill .

I'm a neewbie in ruby and watir and i've been going through all the
helpfiles and examples that i can find to do this but no luck,

Thanks in advance for any help or direction to my search.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: click_no_wait doesn't work when called again

2008-10-23 Thread Bret Pettichord

What happens if you change the second call to click_no_wait to call 
click instead. Do you get an error? What is the error message?

Bret


babylonrei wrote:


 2008/10/22 Bret Pettichord [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED]


 What happens if you add a sleep statement at the location
 indicated below?

 ayanami wrote:
  I'm using method click_no_wait to solve the file download case.
  The problem is that the first time i use click_no_wait to click
 a link
  then a File Download window can be showed.
  but after that I do the same thing again then no File Download
 window
  popup.It like nothing  has been done.
 
  the script is like:
 
 
  ie = Watir::IE.new
  ie.goto(An URL)
  ie.link(:id,).click_no_wait   #here is normal,with the next
  sentence I successfully download a file.
  file_download_method
 

 - Add sleep here
  ie.link(:id,).click_no_wait   #nothing happened here...and
  also no error occured.if I write ie.link(:id,).click instand
  then a file download windows will be showed...
  file_download_method
 
 
  
 


 i did this ,but have no effect.
 i print some infomation to debug the programme,i found that the
 second click_no_wait has been executed.
 but i wonder why i didn't see the FileDownload Dialog?
  
  I'm using method click_no_wait to solve the file download case.
  The problem is that the first time i use click_no_wait to click
 a link
  then a File Download window can be showed.
  but after that I do the same thing again then no File Download
 window
  popup.It like nothing  has been done.
 
  the script is like:
 
 
  ie = Watir::IE.new
  ie.goto(An URL)
  ie.link(:id,).click_no_wait   #here is normal,with the next
  sentence I successfully download a file.
  file_download_method
 

 - Add sleep here
  ie.link(:id,).click_no_wait   #nothing happened here...and
 *i add some print ihere and i can see cmd print my infomation*
  also no error occured.if I write ie.link(:id,).click instand
  then a file download windows will be showed...
  file_download_method

 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to determine a container type from a variable assignment

2008-10-23 Thread niartseoj

Well the exist? did not work as i need to handle situations when the
$atag variable is not assigned..

On Oct 23, 10:49 am, niartseoj [EMAIL PROTECTED] wrote:
 I was able to get my script to work using an exists? however i'm still
 curious as to how to evaluate if an object of if the container type.
 Been looking through element.rb and contain.rb but my ruby skills are
 neewbie level 1.

 Thanks for your time

 On Oct 23, 10:13 am, niartseoj [EMAIL PROTECTED] wrote:

  Hello

  I'm trying to find the method to run in order to determine if a
  variarable is a container and if so what sort of container it is.

  I'm doing this because i have to loop through a table, and identify if
  there is a cell that contains a link with a matching name and a
  certain type of image object.

            t = ie.table(:index,  7)                      # since we
  don't have ID's, look at every table
            for i in 1..t.row_count                  # for every row in this
  table
             t[i].each do |cell|                    # for every column in this
  row, look at its contents
                if cell.text == _userid.to_s
                        if cell.image(:src, /enabled/).exists?
                          $atag = cell.link(:index,1)
                        end
               end
            end
            end

   puts $atag.control_type

  In this code i need to handle if the $atag is set or if it isnill.

  I'm a neewbie in ruby and watir and i've been going through all the
  helpfiles and examples that i can find to do this but no luck,

  Thanks in advance for any help or direction to my search.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Ruby While Loop

2008-10-23 Thread Charley Baker
while(input.Range(b#{x})['

 Value'] != nil)

 if(input.Range(a#{x})['Value'] == 'no')
 x +=1

   next


 end

end


On Thu, Oct 23, 2008 at 8:01 AM, [EMAIL PROTECTED] wrote:


 All,

 I currently have a while loop that iterates as long as the cell it is
 checking an Excel is not nil. I want to add a if statement in this
 while loop that, if the 'if' condition is met, will add 1 to the loop
 iterator, and restart the while loop, without executing the rest of
 the code in the while loop.  Here is my code below:

 while(input.Range(b#{x})['Value'] != nil)

 if(input.Range(a#{x})['Value'] == 'no')
 x +=1
 end

 Can someone please tell how to increment x and restart the while loop,
 without executing the rest of the code in the while first?  I can
 elaborate if this is not clear.  Thanks in advance for all of your
 assistance.

 - Shelton
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to determine a container type from a variable assignment

2008-10-23 Thread niartseoj

I was able to get my script to work using an exists? however i'm still
curious as to how to evaluate if an object of if the container type.
Been looking through element.rb and contain.rb but my ruby skills are
neewbie level 1.

Thanks for your time

On Oct 23, 10:13 am, niartseoj [EMAIL PROTECTED] wrote:
 Hello

 I'm trying to find the method to run in order to determine if a
 variarable is a container and if so what sort of container it is.

 I'm doing this because i have to loop through a table, and identify if
 there is a cell that contains a link with a matching name and a
 certain type of image object.

           t = ie.table(:index,  7)                      # since we
 don't have ID's, look at every table
           for i in 1..t.row_count                  # for every row in this
 table
            t[i].each do |cell|                    # for every column in this
 row, look at its contents
               if cell.text == _userid.to_s
                       if cell.image(:src, /enabled/).exists?
                         $atag = cell.link(:index,1)
                       end
              end
           end
           end

  puts $atag.control_type

 In this code i need to handle if the $atag is set or if it is nill .

 I'm a neewbie in ruby and watir and i've been going through all the
 helpfiles and examples that i can find to do this but no luck,

 Thanks in advance for any help or direction to my search.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How to access a child object

2008-10-23 Thread LanOK

I need to access an object (picture). I know that it's flex object.
I don't know a method which can reach an element OBJECT
If anybody knows, please help.
I thing may be there're any node method (child nodes) which can help
to access this object



http://groups.google.com/group/watir-general/web/1.JPG
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to determine a container type from a variable assignment

2008-10-23 Thread niartseoj

Hello Bret,

Thanks for taking time to help me. You were able to descripher my
example perfectly and your suggestion works great.

I learned a great deal from this example, thanks again for your time.

On Oct 23, 12:04 pm, Bret Pettichord [EMAIL PROTECTED] wrote:
 Thanks for sharing your code. I *think* i know what you are trying to
 do, and there is a way to do this in Watir that is elegant and so far,
 undocumented. I will try to explain it, and if this doesn't work for
 you, please provide more information about what you want to do (and less
 about how you are doing it).

 To me it sounds like you are looking for a cell in a table that has a
 person's name, and image, and a link. And what you want is the link.

 This definition should appear at top level:

     class Watir::Element
       def has_enabled_image_and_text_is name
         text == name  self.image(:src, /enabled/).exists?
       end
     end

 Put this in your test

     t = ie.table(:index, 7)
     $atag = t.cell(:has_enabled_image_and_text_is =
     _userid.to_s).link(:index, 1)

 Please let me know if this works and if I understand what you are trying
 to do.

 Bret

 niartseoj wrote:
  Hello

  I'm trying to find the method to run in order to determine if a
  variarable is a container and if so what sort of container it is.

  I'm doing this because i have to loop through a table, and identify if
  there is a cell that contains a link with a matching name and a
  certain type of image object.

            t = ie.table(:index,  7)                      # since we
  don't have ID's, look at every table
       for i in 1..t.row_count                  # for every row in this
  table
        t[i].each do |cell|                    # for every column in this
  row, look at its contents
           if cell.text == _userid.to_s
                   if cell.image(:src, /enabled/).exists?
                     $atag = cell.link(:index,1)
                   end
          end
       end
       end

   puts $atag.control_type

  In this code i need to handle if the $atag is set or if it is nill .

  I'm a neewbie in ruby and watir and i've been going through all the
  helpfiles and examples that i can find to do this but no luck,

  Thanks in advance for any help or direction to my search.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to access a child object

2008-10-23 Thread LFIdnl

Initially you should to add new tag (if watir doesn't support 'object'
tag):

module Watir
  class Object  NonControlElement
TAG = 'OBJECT'
  end
end

And after use:

ie.frame(:id, 'url').object(:id, 'flexApp')

I didn't test it but i think it must work :)

On 23 окт, 19:44, LanOK [EMAIL PROTECTED] wrote:
 I need to access an object (picture). I know that it's flex object.
 I don't know a method which can reach an element OBJECT
 If anybody knows, please help.
 I thing may be there're any node method (child nodes) which can help
 to access this object

 http://groups.google.com/group/watir-general/web/1.JPG
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to determine a container type from a variable assignment

2008-10-23 Thread Bret Pettichord

Great. I hope others reading can also understand this solution and 
realize that it represents a general solution to a common problem that 
people often ask about.

The problem: How do i find a page element that meets a complex set of 
criteria, possibly including relationships with other objects.

Solution: Don't try to navigate for it yourself. Instead create a 
one-parameter method on Watir::Element that can detect the page element 
you are looking for and then let Watir find it.

Please ask questions if it isn't clear when or how this technique works.

Bret

niartseoj wrote:
 Hello Bret,

 Thanks for taking time to help me. You were able to descripher my
 example perfectly and your suggestion works great.

 I learned a great deal from this example, thanks again for your time.

 On Oct 23, 12:04 pm, Bret Pettichord [EMAIL PROTECTED] wrote:
   
 Thanks for sharing your code. I *think* i know what you are trying to
 do, and there is a way to do this in Watir that is elegant and so far,
 undocumented. I will try to explain it, and if this doesn't work for
 you, please provide more information about what you want to do (and less
 about how you are doing it).

 To me it sounds like you are looking for a cell in a table that has a
 person's name, and image, and a link. And what you want is the link.

 This definition should appear at top level:

 class Watir::Element
   def has_enabled_image_and_text_is name
 text == name  self.image(:src, /enabled/).exists?
   end
 end

 Put this in your test

 t = ie.table(:index, 7)
 $atag = t.cell(:has_enabled_image_and_text_is =
 _userid.to_s).link(:index, 1)

 Please let me know if this works and if I understand what you are trying
 to do.

 Bret

 niartseoj wrote:
 
 Hello
   
 I'm trying to find the method to run in order to determine if a
 variarable is a container and if so what sort of container it is.
   
 I'm doing this because i have to loop through a table, and identify if
 there is a cell that contains a link with a matching name and a
 certain type of image object.
   
   t = ie.table(:index,  7)  # since we
 don't have ID's, look at every table
  for i in 1..t.row_count  # for every row in this
 table
   t[i].each do |cell|# for every column in this
 row, look at its contents
  if cell.text == _userid.to_s
  if cell.image(:src, /enabled/).exists?
$atag = cell.link(:index,1)
  end
 end
  end
  end
   
  puts $atag.control_type
   
 In this code i need to handle if the $atag is set or if it is nill .
   
 I'm a neewbie in ruby and watir and i've been going through all the
 helpfiles and examples that i can find to do this but no luck,
   
 Thanks in advance for any help or direction to my search.
   
 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-23 Thread Bret Pettichord

This code is IE specific.

al3kc wrote:
 Should this work for FireWatir? I tried to change it for
 FireWatir::Element but it doesn't work.

 Željko Filipin [EMAIL PROTECTED] wrote:
   
 On Mon, Sep 8, 2008 at 5:48 PM, Bret Pettichord [EMAIL PROTECTED] wrote:
 
 I think you need to require something before using this method. Any one?
   
 http://wiki.openqa.org/pages/viewpage.action?pageId=1119
 

 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] table row_count incorrect

2008-10-23 Thread Paul Denize

The following watir code is enough to demonstrate the flaw in the
row_count method.
The table has 2 rows - but watir return 6.

The problem is tables embedded in tables and the rowcount simply
counting TR tags from the outside.  Therefore it counts inner table
rows as well

Code can then fail when cycling through the rows - the code below
fails when you try to access row 3 (of the 6 rows) when in fact there
are only 2 rows.



ie = Watir::IE.new()
ie.goto(https://www.google.com/accounts/NewAccount;)
t = ie.table(:index,1)
puts t
t.row_values(3)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: table row_count incorrect

2008-10-23 Thread Paul Denize

This is not the only routine and while digging I found comments like

 # This method returns the table as a 2 dimensional array. Dont expect
too much if there are nested tables, colspan etc.

All the routines seem to use the following process

rows = table object.getElementsByTagName(TR).length

Now looks more like a limitation than a bug
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: table row_count incorrect

2008-10-23 Thread Paul Denize

Overloading the following seems to get past the limitations.  Perhaps
someone with more DOM experience can comment if there are any dangers

One thin I did notice is that it picks up TH data cells just like
TD ones


class Table
def row_count
assert_exists
return @o.rows().length
end

def to_a
  assert_exists
  y = []
  table_rows = @o.rows()
  for row in table_rows
puts row.to_a.inspect
x = []
for td in row.cells()
  x  td.innerText.strip
end
y  x
  end
  return y
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: table row_count incorrect

2008-10-23 Thread Alan Baird
Paul -
This issue is WTR-26
(http://jira.openqa.org/browse/WTR-26)http://jira.openqa.org/browse/WTR-26,
it's been around for a while.  Your solution looks like the one that is in
this ticket.

Alan

On Thu, Oct 23, 2008 at 9:10 PM, Paul Denize [EMAIL PROTECTED]wrote:


 Overloading the following seems to get past the limitations.  Perhaps
 someone with more DOM experience can comment if there are any dangers

 One thin I did notice is that it picks up TH data cells just like
 TD ones


 class Table
def row_count
assert_exists
return @o.rows().length
end

def to_a
  assert_exists
  y = []
  table_rows = @o.rows()
  for row in table_rows
puts row.to_a.inspect
x = []
for td in row.cells()
  x  td.innerText.strip
end
y  x
  end
  return y
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---