[wtr-general] Re: Access an object

2009-02-17 Thread Isabel
I tried to use the function that you had put up at the link below: http://aspn.activestate.com/ASPN/Mail/Message/ruby-talk/3690066 Made a few changes though: def element *args arg1, arg2 = args # this is needed so hashes would work as input elements = [ :table, :link, :cell, :image, :checkb

[wtr-general] Re: Access an object

2009-01-19 Thread Jarmo Pertman
Hello. As I answered to your question in Ruby-Forum, I'm going to paste the answer here also. I used different approach than xpath, since I've discovered that XPath in Watir+IE is really-really slow. I haven't benchmarked my current solution, but last time I tried something like text_field(:name,

[wtr-general] Re: Access an object

2009-01-14 Thread wesley chen
Thanks very much. I study from you again, :) Thanks. Wesley Chen. On Wed, Jan 14, 2009 at 11:59 AM, Richard Lawrence wrote: > > You don't get back the specific object type from element_by_xpath, so > some methods don't work. But this works: > > b = Watir::IE.new > b.goto 'http://www.google.com/'

[wtr-general] Re: Access an object

2009-01-14 Thread TCBlues
Thanks a lot. On 14 ene, 03:59, Richard Lawrence wrote: > You don't get back the specific object type from element_by_xpath, so > some methods don't work. But this works: > > b = Watir::IE.new > b.goto 'http://www.google.com/' > txt = b.element_by_xpath("//*...@name='q']") > txt.value = 'Richard

[wtr-general] Re: Access an object

2009-01-13 Thread Richard Lawrence
You don't get back the specific object type from element_by_xpath, so some methods don't work. But this works: b = Watir::IE.new b.goto 'http://www.google.com/' txt = b.element_by_xpath("//*...@name='q']") txt.value = 'Richard Lawrence' btn = b.element_by_xpath("//*...@name='btnG']") btn.click S

[wtr-general] Re: Access an object

2009-01-13 Thread wesley chen
We can't use "set", "exists?" and many other methods after comment :element_by_xpath Thanks. Wesley Chen. On Wed, Jan 14, 2009 at 12:46 AM, TCBlues wrote: > > Thanks for your answer. > > In the case the object is a textField or a listField I'm trying to set > the control with: > ie.element_by_

[wtr-general] Re: Access an object

2009-01-13 Thread TCBlues
Thanks for your answer. In the case the object is a textField or a listField I'm trying to set the control with: ie.element_by_xpath("//*...@name="imp1"]").set("testing") but an error comes up: 13:in `method_missing': unknown property or method `set' (WIN32OLERuntimeError) --~--~-~--~-

[wtr-general] Re: Access an object

2009-01-13 Thread Tiffany Fodor
Hi! The only way I know to do this would be to perform an exists? check on the various objects that this could be and click it if it exists. if ie.button(:name, 'imp1').exists? ie.button(:name, 'imp1').click elsif ie.link(:name, 'imp1').exists? ie.link(:name, 'imp1').click end Hope this h

[wtr-general] Re: Access an object

2009-01-13 Thread Richard Lawrence
This ought to do it: require 'watir' include Watir ie=IE.new ie.goto("file://c:/temp2.htm") ie.element_by_xpath("//*...@name='imp1']").click() Richard -- Richard Lawrence Certified Scrum Coach Founder and Principal Consultant, Humanizing Work, LLC 303-895-7688 rich...@humanizingwork.co