[wtr-general] How can I add some methods to Table class?

2011-04-13 Thread Ekin Han
Hi all,

Rencently I found that I will add some methods to Watir::Table class.So
i wrote some codes like following:

module Watir
  class Table
def the_method_i_want_to_add
  #somthing
end
  end
end

I saved these codes in a file and during the runtime i required this file.

But it does not work, some errors like 'undifined mehod autoit for Watir
module...' occured.

How can I add some methods to the Table class without modify the source
code? I just want to add the method during the runtime.

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: checkbox set but returns false for set?

2011-04-13 Thread bryan rasmussen
Yeah this actually turns out to be the problem, which I had thought
before but had tried to solve incorrectly.

What I do now that works:

checkbox.fire_event(onclick)
checkbox.set

what I did before that did not work
checkbox.set
checkbox.click

or just
checkbox.click

Thanks,
Bryan Rasmussen

On Tue, Apr 12, 2011 at 7:16 PM, Chuck van der Linden sqa...@gmail.com wrote:
 You may also need to consider the point that the thing is obviously
 got some javascript interacting with it, since it is wired up to
 respond to clicks..   Did you notice this part

 onclick=toggle_alt(this, 'PP-INTERNET-HOSTING-EN_CL1_ALT1', 'panel_PP-
 INTERNET-HOSTING-EN_CL1_ALT1')

 try seeing what happens if you .click  on it instead of using .set,
 or .click it after using .set

 Also try having a good look at the DOM with that thing both set and
 unset (doing that manually with the mouse) and see if perhaps the ID
 is changing or something?   I can't be sure what that javascript code
 is doing, but 'swap' in the name makes me suspect it's changing some
 aspect of the element (perhaps just it's alt text, but maybe it's ID
 also)


 On Apr 12, 6:31 am, Super Kevy kpe...@scholarshipamerica.org wrote:
 Try checked?

 as puts ie.checkbox(:id,'myid').checked?

 On Apr 11, 4:11 am, bryan rasmussen.br...@gmail.com wrote:







  Hi,
  I asked this some days ago in a webdriver forum but haven't gotten any
  response.
  It's sort of a followup to my earlier question on how to set the value
  of an input element because I decided just to change the code to make
  it explicitly find the element as a checkbox.

  I have the following code:

  When /^I (un)?check ([^\]*)$/ do |negate, checkbox_label|
    flag = (un != negate)
    checkbox = $browser.checkbox(:id, checkbox_label)
    puts checkbox.exists?
   puts checking checkbox
   puts checkbox.set?
   if(flag)
   puts now what
    checkbox.set
    puts checkbox.set?
   else
   puts dont set id
    checkbox.clear
   end
  end

  The html that is being checked is

  input type=checkbox title=Tilføj til din aftale
  autocomplete=off id=check_PP-INTERNET-HOSTING-EN_CL1_ALT1
  onclick=toggle_alt(this, 'PP-INTERNET-HOSTING-EN_CL1_ALT1',
  'panel_PP-
  INTERNET-HOSTING-EN_CL1_ALT1');

  And the output reads

  true
  checking checkbox
  false
  now what
  false
      And I check check_PP-INTERNET-HOSTING-EN_CL7_ALT1

  so true checkbox exists,
  no error when I try to checkbox.set,
  but false for checkbox.set?

  Any ideas what can be causing this, and any ways I can get around it.

  Thanks,
  Bryan Rasmussen

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

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.com


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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] FireWatir double click (with ZK, I am so so so sorry)

2011-04-13 Thread Francisco Diaz Trepat - gmail
Hi guys I am trying to do a select on a patient by which I need to do a
double click on a table row.

The ZK part is this:

public void render(Treeitem item, Object data) throws Exception {
blah blah... some code
   item.getTreerow().addEventHandler(onDoubleClick, new EventHandler(new
ZScript(
 null, java,
ar.com.eoc.hco.util.ComponentsUtil.getContainerWindow(self).doAction(self.parent.value),
null),
 null));
blah blah some other code.

My latest futile (that I read on some blog about doing first a onmouseover
and then the doubleclick) try is:


  if(@browser.div(:class, z-window-modal).divs(:class,
z-tree-cell-cnt)[0].exist? and @browser.div(:class,
z-window-modal).div(:text, patient_medical_record.to_s).exist?) then
#this element holds a small right pointing arrow that collapses when
clicked, but also is the first left most element in the row.
element = @browser.div(:class, z-window-modal).divs(:class,
z-tree-cell-cnt)[0].span(:class, z-tree-ico z-tree-root-close)
sleep 3
#element.parent.parent.parent.click
puts First OnClick Fired
element.parent.parent.parent.fire_event(onmouseover, 1)
element.parent.parent.parent.fire_event(ondblclick, 1)

sleep 5
  end


This throws a JavaScript Error:

For input string: NaN

Any Ideas? How about trying to execute the javascript function delegate for
the event?

Please I really need Urgent help, I am working on an Ubuntu 10.10 64 machine
and I am not used to the WebDriver limitations, although I have been able to
advance pretty well, but not on this double click issue.

The HTML is awful really really awful, I am new to this project and I am
only here to test it via Watir:

div class=z-center-body id=z_4e_ve1!cave style=width: 1913px; height:
406px;
 div style=height: 100%; id=z_4e_0f1
div onselectstart=return false; onmousedown=return false
z.fixed=false z.tchsib=z_4e_ef1 z.vflex=true z.selid=zk_n_a
z.size=0 z.zcls=z-tree style=height: 90%; background: none repeat
scroll 0% 0% rgb(255, 255, 255); class=z-tree z.type=zul.tree.Tree
id=z_4e_1f1 zk_realsize=17

div class=z-tree-header id=z_4e_1f1!head style=width: 1911px;
table cellspacing=0 cellpadding=0 border=0 width=100%
style=table-layout: fixed; width: 1911px;
 tbody style=visibility: hidden; height: 0px;
tr class=z-tree-faker id=z_4e_2f1!hdfaker
 th z.zcls=z-tree-col style=width: 954px; class=z-tree-col
id=z_4e_3f1!hdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 287px; class=z-tree-col
id=z_4e_4f1!hdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 96px; class=z-tree-col
id=z_4e_5f1!hdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 478px; class=z-tree-col
id=z_4e_6f1!hdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 96px; class=z-tree-col
id=z_4e_7f1!hdfaker
div style=overflow: hidden;/div
/th
 /tr
/tbody
 tbodytr align=left z.rid=z_4e_1f1 z.zcls=z-tree-cols
class=z-tree-cols z.type=Tcols id=z_4e_2f1
 th z.zcls=z-tree-col style=width: 948px; class=z-tree-col
z.type=Tcol id=z_4e_3f1div class=z-tree-col-cnt id=z_4e_3f1!cave
style=width: 948px;Name/div/th
 th z.zcls=z-tree-col style=width: 281px; class=z-tree-col
z.type=Tcol id=z_4e_4f1div class=z-tree-col-cnt id=z_4e_4f1!cave
style=width: 281px;DOB/div/th
 th z.zcls=z-tree-col style=width: 90px; class=z-tree-col
z.type=Tcol id=z_4e_5f1div class=z-tree-col-cnt id=z_4e_5f1!cave
style=width: 90px;Gender/div/th
 th z.zcls=z-tree-col style=width: 472px; class=z-tree-col
z.type=Tcol id=z_4e_6f1div class=z-tree-col-cnt id=z_4e_6f1!cave
style=width: 472px;Medical Record Number/div/th
 th z.zcls=z-tree-col style=width: 90px; class=z-tree-col
z.type=Tcol id=z_4e_7f1div class=z-tree-col-cnt id=z_4e_7f1!cave
style=width: 90px;/div/th
/tr
 /tbody/table
/div

div class=z-tree-body id=z_4e_1f1!body style=height: 343px; width:
1911px;
table cellspacing=0 cellpadding=0 border=0 width=100% style=width:
1911px;
 tbody style=visibility: hidden; height: 0px;
tr class=z-tree-faker id=z_4e_2f1!bdfaker
 th z.zcls=z-tree-col style=width: 954px; class=z-tree-col
id=z_4e_3f1!bdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 287px; class=z-tree-col
id=z_4e_4f1!bdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 96px; class=z-tree-col
id=z_4e_5f1!bdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 478px; class=z-tree-col
id=z_4e_6f1!bdfaker
div style=overflow: hidden;/div
/th
 th z.zcls=z-tree-col style=width: 96px; class=z-tree-col
id=z_4e_7f1!bdfaker
div style=overflow: hidden;/div
/th
 /tr
/tbody
tbody z.zcls=z-tree-children class=z-tree-children id=z_4e_ef1
tr z.visible=true z.dbclk=true z.lod=t z.tchsib=z_4e_u32
z.ptch=z_4e_ef1 z.rid=z_4e_1f1 z.pitem=z_4e_n32 z.zcls=z-tree-row
class=z-tree-row z.type=Trow id=z_4e_o32
 td z.zcls=z-tree-cell style=width: 50%; class=z-tree-cell
id=z_4e_p32 z.type=Licdiv 

[wtr-general] how to simulate Enter on a jumper box

2011-04-13 Thread a b
Hi all,

I didn't find any example on how to simulate Enter on a jump field.

I have a jump/search text field and is working only when we hit enter. I do
not have any other button..
I do not know how to do it on watir. I searched on watir group/
stackoverflow and google it but I didn't find anything to help me.

Please let me know if I can find any example or any information.

Hope One encountered that issue.

Regards,
Cristina

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: how to simulate Enter on a jumper box

2011-04-13 Thread a b
I have attached the code screen snapshot.

Thanks,
Cristina

On Wed, Apr 13, 2011 at 3:17 PM, a b cristina.watir.toro...@gmail.comwrote:

 Hi all,

 I didn't find any example on how to simulate Enter on a jump field.

 I have a jump/search text field and is working only when we hit enter. I do
 not have any other button..
 I do not know how to do it on watir. I searched on watir group/
 stackoverflow and google it but I didn't find anything to help me.

 Please let me know if I can find any example or any information.

 Hope One encountered that issue.

 Regards,
 Cristina


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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] How can I add some methods to Table class?

2011-04-13 Thread Dmitriy Korobskiy

Ekin,

I use monkey patching of Watir that works:

require 'watir'

# == Monkey patch Watir for better compatibility with 
Watir-WebDriver ==


require 'watir/element_collections'
Watir::ElementCollections.class_eval do
  alias_method :original_array_op, :[]

  # Zero-based array operator
  def [](n)
return original_array_op(n+1)
  end
end

require 'watir/container'
require 'watir/element'
require 'watir/table'
Watir::TableRow.class_eval do
  alias_method :original_array_op, :[]

  # Zero-based array operator
  def [](n)
return original_array_op(n+1)
  end
end

You can add new methods in the same manner.

I ran into interesting issues when I tried to do it initially. Here is 
the StackOverflow discussion on why additional require-s are needed: 
http://stackoverflow.com/questions/4893923/weird-problems-with-reopening-ruby-classes


--
DK
AIM: DKroot1, Skype: DKroot


On 4/13/11 4:19 AM, Ekin Han wrote:

Hi all,

Rencently I found that I will add some methods to Watir::Table 
class.So i wrote some codes like following:


module Watir
  class Table
def the_method_i_want_to_add
  #somthing
end
  end
end

I saved these codes in a file and during the runtime i required this file.

But it does not work, some errors like 'undifined mehod autoit for 
Watir module...' occured.


How can I add some methods to the Table class without modify the 
source code? I just want to add the method during the runtime.

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


watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: how to simulate Enter on a jumper box

2011-04-13 Thread orde
If I'm following your question correctly, you can activate the Enter
key via the send_keys method.

For example: browser.send_keys('{ENTER}')

For more info, see 
http://wtr.rubyforge.org/rdoc/1.6.5/classes/Watir/IE.html#M000497

Hope it helps.

orde

On Apr 13, 1:01 pm, a b cristina.watir.toro...@gmail.com wrote:
 I have attached the code screen snapshot.

 Thanks,
 Cristina

 On Wed, Apr 13, 2011 at 3:17 PM, a b cristina.watir.toro...@gmail.comwrote:







  Hi all,

  I didn't find any example on how to simulate Enter on a jump field.

  I have a jump/search text field and is working only when we hit enter. I do
  not have any other button..
  I do not know how to do it on watir. I searched on watir group/
  stackoverflow and google it but I didn't find anything to help me.

  Please let me know if I can find any example or any information.

  Hope One encountered that issue.

  Regards,
  Cristina

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] How can I add some methods to Table class?

2011-04-13 Thread Ekin Han
Hi Dmitriy,

It helps a lot, I will try it later.

Thank you very much

2011/4/14 Dmitriy Korobskiy dkro...@gmail.com

 Ekin,

 I use monkey patching of Watir that works:

require 'watir'

# == Monkey patch Watir for better compatibility with
 Watir-WebDriver ==

require 'watir/element_collections'
Watir::ElementCollections.class_eval do
  alias_method :original_array_op, :[]

  # Zero-based array operator
  def [](n)
return original_array_op(n+1)
  end
end

require 'watir/container'
require 'watir/element'
require 'watir/table'
Watir::TableRow.class_eval do
  alias_method :original_array_op, :[]

  # Zero-based array operator
  def [](n)
return original_array_op(n+1)
  end
end

 You can add new methods in the same manner.

 I ran into interesting issues when I tried to do it initially. Here is the
 StackOverflow discussion on why additional require-s are needed:
 http://stackoverflow.com/questions/4893923/weird-problems-with-reopening-ruby-classes

 --
 DK
 AIM: DKroot1, Skype: DKroot



 On 4/13/11 4:19 AM, Ekin Han wrote:

 Hi all,

Rencently I found that I will add some methods to Watir::Table class.So
 i wrote some codes like following:

 module Watir
  class Table
def the_method_i_want_to_add
  #somthing
end
  end
 end

 I saved these codes in a file and during the runtime i required this file.

 But it does not work, some errors like 'undifined mehod autoit for Watir
 module...' occured.

 How can I add some methods to the Table class without modify the source
 code? I just want to add the method during the runtime.
 --
 Before posting, please read http://watir.com/support. In short: search
 before you ask, be nice.

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.com


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

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.com


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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com