[wtr-general] Not able to click on a TD through Watir, though manually it is possible
I have a calendar using which I can set the date in the given text area. For this I need to click on a calendar icon and choose dates(by clicking on them) from the calendar that pops up. When I click on close on the calendar, the selected dates get set in the text area. now the problem is that .click apparently has no effect on the date which is a table cell and there seems to be no known JavaScript event that has been applied on it. the code for the calendar is as below:- TABLE cellSpacing=0 cellPadding=0 unselectable=trueTHEAD unselectable=trueTR unselectable=trueTD class=title unselectable=true navtype=400 ttip=About the calendar /TDTD class=title style=CURSOR: move colSpan=5 unselectable=true navtype=300 ttip=Drag to moveJanuary, 2011/TDTD class=title unselectable=true navtype=200 ttip=Closeclose/TD/TRTR unselectable=true/TR/THEADTHEAD unselectable=trueTR class=daynames unselectable=trueTD class=name day weekend unselectable=truenbsp;nbsp; S/TDTD class= day name unselectable=true navtype=100 ttip=Display Monday first fdow=1nbsp;nbsp; M/TDTD class=name day unselectable=true navtype=100 ttip=Display Tuesday first fdow=2nbsp;nbsp; T/ TDTD class=name day unselectable=true navtype=100 ttip=Display Wednesday first fdow=3nbsp;nbsp; W/TDTD class= day name unselectable=true navtype=100 ttip=Display Thursday first fdow=4nbsp;nbsp; T/TDTD class=name day unselectable=true navtype=100 ttip=Display Friday first fdow=5nbsp;nbsp; F/TDTD class=name day weekend unselectable=true navtype=100 ttip=Display Saturday first fdow=6nbsp;nbsp; S/TD/TR/THEADTBODY unselectable=trueTR class=daysrow unselectable=trueTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/ TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/ TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TDTD class=weekend false day unselectable=true ttip=_ otherMonth=false1/TD/TRTR class=daysrow unselectable=trueTD class= day false weekend unselectable=true ttip=_ otherMonth=false2/TDTD class= day false unselectable=true ttip=_ otherMonth=false3/TDTD class= day false unselectable=true ttip=_ otherMonth=false4/TDTD class= day false unselectable=true ttip=_ otherMonth=false5/ TDTD class= day false unselectable=true ttip=_ otherMonth=false6/TDTD class= day false unselectable=true ttip=_ otherMonth=false7/TDTD class=weekend false day unselectable=true ttip=_ otherMonth=false8/TD/TRTR class=daysrow unselectable=trueTD class= day false weekend unselectable=true ttip=_ otherMonth=false9/TDTD class= day false unselectable=true ttip=_ otherMonth=false10/TDTD class= day false unselectable=true ttip=_ otherMonth=false11/ TDTD class=false day selected unselectable=true ttip=_ otherMonth=false12/TDTD class=false day unselectable=true ttip=_ otherMonth=false13/TDTD class=selected day false unselectable=true ttip=_ otherMonth=false14/TDTD class= day false weekend unselectable=true ttip=_ otherMonth=false15/ TD/TRTR class=daysrow unselectable=trueTD class= day false weekend unselectable=true ttip=_ otherMonth=false16/TDTD class= day false unselectable=true ttip=_ otherMonth=false17/ TDTD class= day false unselectable=true ttip=_ otherMonth=false18/TDTD class= day false unselectable=true ttip=_ otherMonth=false19/TDTD class= day false unselectable=true ttip=_ otherMonth=false20/TDTD class= day false unselectable=true ttip=_ otherMonth=false21/TDTD class= day false weekend unselectable=true ttip=_ otherMonth=false22/TD/TRTR class=daysrow unselectable=trueTD class= day false weekend unselectable=true ttip=_ otherMonth=false23/TDTD class= day false unselectable=true ttip=_ otherMonth=false24/TDTD class= day false unselectable=true ttip=_ otherMonth=false25/TDTD class= day false unselectable=true ttip=_ otherMonth=false26/ TDTD class= day false unselectable=true ttip=_ otherMonth=false27/TDTD class= day false unselectable=true ttip=_ otherMonth=false28/TDTD class= day false weekend unselectable=true ttip=_ otherMonth=false29/TD/TRTR class=daysrow unselectable=trueTD class= day false weekend unselectable=true ttip=_ otherMonth=false30/TDTD class= day false unselectable=true ttip=_ otherMonth=false31/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/ P/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/ TDTD class= day disabled unselectable=true otherMonth=truePnbsp;/P/TD/TR/TBODYTFOOT unselectable=trueTR class=footrow unselectable=trueTD class=ttip style=CURSOR: move colSpan=7 unselectable=true navtype=300 ttip=Drag to moveSelect date/TD/TR/TFOOT/ TABLE Please help... Thanks in advance. --~--~-~--~~~---~--~~ You received this message
[wtr-general] Re: Unable to attach to a page on makemytrip
Hi all, I tried using all the methods mentioned above (static and dynamic wait), but still I am not able to work on it. The Search Result page does not get loaded completely due to which the ie.image(:src,http://www.makemytrip.com/images/search-for- flights.gif).click does not get passed and hence the next line of code is not taken up. Can anyone let me know some work around for this? Also please let me know the Ruby and Watir version that you have used. Thanks and Regards On May 12, 9:57 pm, Eric Morris ewmo...@wildblue.net wrote: I added a 30 second sleep because the page is still processing info when it loads and the button does not exist and it worked fine for me. You might not need to wait that long just the first value I tried. require 'watir' ie=Watir::IE.new ie.goto(www.makemytrip.com) ie.link(:href,http://www.makemytrip.com/international-flights/;).click ie.text_field(:id,departure_0).set(Delhi,India-Indira Gandhi Intl(DEL)) ie.text_field(:id,arrival_0).set(Chicago,US-All airports-IL(CHI)) ie.image(:src,http://www.makemytrip.com/images/search-for-flights.gif ).click sleep 30 ie.image(:src,http://cheapfaresindia.makemytrip.com/international/img/us/booknow.gif ).click Thanks, Eric On Mon, May 11, 2009 at 11:55 PM, Pallavi Sharma write2pall...@gmail.comwrote: Nothing happens. Anyone here, could you please help. Need a solution badly. On Mon, May 11, 2009 at 7:48 PM, Ravi myrav...@gmail.com wrote: Insert the following line after clicking search-for-flights.gif: Watir::Waiter.wait_until{ie.image(:src,http:// cheapfaresindia.makemytrip.com/international/img/us/ booknow.gif).exist?} On May 11, 1:56 am, Pallavi Sharma write2pall...@gmail.com wrote: You are right Santosh, this is exactly the problem, i was trying to potray but thanks for making it clear, watir gets hanged after executing the second last step. No step after it gets executed. On Mon, May 11, 2009 at 12:15 PM, SANTOSH SOLAPURKAR sansolapur...@gmail.com wrote: Hi All, This doent seem to be frame or other issue at all, what i see this as there is a problem with the website itself. once we do the search for the international flights the web page doesnot completely load, as in eventhough it shows done it still keeps on downloading some thing probably javascript namely sort(5). To test this you can do a simple test. after the ie.image(:src, http://www.makemytrip.com/images/search-for-flights.gif;).click statement put a puts command to print some thing and run the script. this still hangs and doenot print any thing on console . require 'watir' ie=Watir::IE.new ie.speed=:fast ie.goto(www.makemytrip.com) ie.link(:href,http://www.makemytrip.com/international-flights/ ).click ie.text_field(:id,departure_0).value=Delhi,India-Indira Gandhi Intl(DEL) ie.text_field(:id,arrival_0).value=Chicago,US-All airports-IL(CHI) ie.image(:src, http://www.makemytrip.com/images/search-for-flights.gif;).click #This works, after which IDE hangs puts the page has loaded # This never gets executed.. #ie.image(:src, http://cheapfaresindia.makemytrip.com/international/img/us/booknow.gif ).click #DOESNT GET EXECUTED I dont know how to resolve this but need to stop the java script from downloading . Hope we resolve this.. Cheers, Santosh On Mon, May 11, 2009 at 11:02 AM, Pallavi Sharma write2pall...@gmail.comwrote: Hi Everyone require 'watir' ie=Watir::IE.new ie.speed=:fast ie.goto(www.makemytrip.com) ie.link(:href,http://www.makemytrip.com/international-flights/ ).click ie.text_field(:id,departure_0).value=Delhi,India-Indira Gandhi Intl(DEL) ie.text_field(:id,arrival_0).value=Chicago,US-All airports-IL(CHI) ie.image(:src, http://www.makemytrip.com/images/search-for-flights.gif;).click #This works, after which IDE hangs ie.image(:src, http://cheapfaresindia.makemytrip.com/international/img/us/booknow.gif ).click #DOESNT GET EXECUTED Thanks for the reply so far, but i just want to clear my understanding, The last step of the above script is not getting executed, the reason for it is because 'watir' is not able to access the frames on the page. But I have checked with IE Devloper tool bar there are no frames on the Search Result page, which you get after you execute the second last step of the script. I am sorry, if i am missing something out from the answers i have recieved sod far, but i am not able to understand why this above script is not getting executed. Meanwhile i have tried the above on 5 different machines, but it doesn't works. On Sun, May 10, 2009 at 6:14 AM, Vicky Goyal vikasrattango...@gmail.comwrote: @Pallavi As siva has mentioed, tht same defect is already open. If you are not able to see
[wtr-general] Re: Unable to attach to a page on makemytrip
Hi All, We figured out how to go about it. We just had to replace .click with .click_no_wait Hence my script now is require 'watir' ie=Watir::IE.new ie.goto(www.makemytrip.com) ie.link(:href,http://www.makemytrip.com/international- flights/).click ie.text_field(:id,departure_0).value=Delhi,India-Indira Gandhi Intl (DEL) ie.text_field(:id,arrival_0).value=Chicago,US-All airports-IL(CHI) ie.image(:src,http://www.makemytrip.com/images/search-for- flights.gif).click_no_wait Watir::Waiter.wait_until{ie.image(:src,http:// cheapfaresindia.makemytrip.com/international/img/us/ booknow.gif).exist?} ie.image(:src,http://cheapfaresindia.makemytrip.com/international/img/ us/booknow.gif).click Thanks to everyone for their inputs... --~--~-~--~~~---~--~~ 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: Unable to attach to a page on makemytrip
Please find the script below: require 'watir' ie=Watir::IE.new ie.goto(www.makemytrip.com) ie.link(:href,http://www.makemytrip.com/international- flights/).click ie.text_field(:id,departure_0).set(Delhi,India-Indira Gandhi Intl (DEL)) ie.text_field(:id,arrival_0).set(Chicago,US-All airports-IL(CHI)) ie.image(:src,http://www.makemytrip.com/images/search-for- flights.gif).click ie.image(:src,http://cheapfaresindia.makemytrip.com/international/img/ us/booknow.gif).click This gets stuck at the second last action. :( On May 8, 10:36 am, Isabel joybe...@gmail.com wrote: Hi all, i am unable to attach on the results page ofwww.makemytrip.com. Whenever I search for a particular flight and want to sort the results, watir apparently gets hung on the results page... Please let me know why this is so... --~--~-~--~~~---~--~~ 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] Unable to attach to a page on makemytrip
Hi all, i am unable to attach on the results page of www.makemytrip.com. Whenever I search for a particular flight and want to sort the results, watir apparently gets hung on the results page... Please let me know why this is so... --~--~-~--~~~---~--~~ 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] Strange issue with ie.attach()
Hi All, Yesterday while working on watir, suddenly ie.attach() stopped working for me. It started working again on restarting the system. Has anyone of you come across something like this? If yes, why is this so? Thanks and Regards. --~--~-~--~~~---~--~~ 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: Strange issue with ie.attach()
Hi Željko, I really appreciate your effort to at least pass on opinions from others... But I could not find any text on the link you gave apart from Windows is a steaming pile of crap. :) Is this the answer to my query? Or was I looking at the wrong place? Thanks... On Apr 30, 12:40 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Thu, Apr 30, 2009 at 08:52, Isabel joybe...@gmail.com wrote: why is this so? It is described in painful detail here: http://twitter.com/zeljkofilipin/status/1651116660 Disclaimer: this is not my opinion, I just quote what other people think :) Željko --http://watirpodcast.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 watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Multiple Attributes
thnx... On Apr 14, 3:07 pm, Татьяна Запольская tzapolsk...@gmail.com wrote: Hi, Isabel! For me Multiple Attributes works. I'm also using watir 1.6.2. I have tried this code when 'Portal application (IBM)' link is already clicked (class = active): ie=Watir::IE.attach(:title, /Help/) temp = ie.frame(:name, HelpFrame).frame(:name, NavFrame).frame(:name, ViewsFrame).frame(:id, toc).frame(:name,tocViewFrame) temp.link(:text = Portal application (IBM), :class = active, :href= /publib.boulder.ibm.com/ ).clickhttp://publib.boulder.ibm.com/infocenter/systems/topic/rzamm/rzammcon...;).click and the link was clicked. I have tried this code when 'Portal application (IBM)' is not clicked (class = ): ie=Watir::IE.attach(:title, /Help/) temp = ie.frame(:name, HelpFrame).frame(:name, NavFrame).frame(:name, ViewsFrame).frame(:id, toc).frame(:name,tocViewFrame) temp.link(:text = Portal application (IBM), :class = , :href = /publib.boulder.ibm.com/http://publib.boulder.ibm.com/infocenter/systems/topic/rzamm/rzammcon...;).click ).clickhttp://publib.boulder.ibm.com/infocenter/systems/topic/rzamm/rzammcon...;).click the link was clicked. Please reply if you still have problems. Best Regards, Tanya Zapolskaya 2009/4/14 Isabel joybe...@gmail.com Hi, I tried to click on a link 'Portal application (IBM)' on http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/rza... using the script below:- require 'watir' ie=Watir::IE.attach(:title, //) ie.frame(:name , 'HelpFrame').frame(:name , 'NavFrame').frame(:name , 'ViewsFrame').frame(:id , 'toc').frame(:name , 'tocViewFrame').link (:text = 'Portal application (IBM)',:class = 'active',:href = 'http://publib.boulder.ibm.com/infocenter/syst').click But it gave an error c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/ watir/element.rb:52:in `assert_exists': Unable to locate element, using {:href=http://publib.boulder.ibm.com/infocenter/systems/topic/ rzamm/rzammconceptsportalapplication.htm?tocNode=toc:front/front.cmb/ 0/1/3/1/0/7/1/, :class=active, :text=Portal application (IBM)} (Watir::Exception::UnknownObjectException) But if I use each of the attribute (text,class and href) individually, this works. I want to know why Multiple Attributes are not being supported as mentioned on http://wiki.openqa.org/display/WTR/Methods+Supported+by+Element Thanks --~--~-~--~~~---~--~~ 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] Multiple Attributes
Hi, I tried to click on a link 'Portal application (IBM)' on http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/rzamm/rzammportletsRefIFrame.htm using the script below:- require 'watir' ie=Watir::IE.attach(:title, //) ie.frame(:name , 'HelpFrame').frame(:name , 'NavFrame').frame(:name , 'ViewsFrame').frame(:id , 'toc').frame(:name , 'tocViewFrame').link (:text = 'Portal application (IBM)',:class = 'active',:href = 'http://publib.boulder.ibm.com/infocenter/syst').click But it gave an error c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/ watir/element.rb:52:in `assert_exists': Unable to locate element, using {:href=http://publib.boulder.ibm.com/infocenter/systems/topic/ rzamm/rzammconceptsportalapplication.htm?tocNode=toc:front/front.cmb/ 0/1/3/1/0/7/1/, :class=active, :text=Portal application (IBM)} (Watir::Exception::UnknownObjectException) But if I use each of the attribute (text,class and href) individually, this works. I want to know why Multiple Attributes are not being supported as mentioned on http://wiki.openqa.org/display/WTR/Methods+Supported+by+Element Thanks --~--~-~--~~~---~--~~ 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] Count Open Browsers
Hi, Could anyone pleae let me know a way to count the number of browsers that are open on my system at run time?? Thanks. --~--~-~--~~~---~--~~ 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: Count Open Browsers
how do we use process_count() work?? On Apr 9, 12:11 pm, Isabel joybe...@gmail.com wrote: Hi, Could anyone pleae let me know a way to count the number of browsers that are open on my system at run time?? Thanks. --~--~-~--~~~---~--~~ 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] Frames and Tables
Hi All, I have a frame with a table in it. The only information I have as input is the table, the row id, the column id and an index. Now I have to access the specific cell and then fetch elements within the cell which might be 1 (for eg a link and a button or a link and a text_field etc). After fetching all the elements, the index will help me to identify which element out of all the elements in the cell is the one that I have to perform an action on. I could work with radio and checkboxes in cells as they have a type as radio or checkbox but could not work with links yet. Any input will be highly appreciated as I have been quite stuck up at this. Thanks and Regards... --~--~-~--~~~---~--~~ 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] multiple objects having same properties
Hi all, Is there a way of identifying the objects on a page having the same properties?? For instance:- ie.show_links would give me all the links on the page, but what if I want to know about all the links having say name as lmn??? --~--~-~--~~~---~--~~ 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: Multiple Attributes for Input Elements
Hi Michael, I tried this too require 'watir' ie=Watir::IE.new ie.goto www.google.com ie.text_field(:name = q ,:index = 2).set(xyz) Still I am getting an error. ie.text_field(:name = q ,:index = 1).set(xyz) and ie.text_field(:index = 2).set(xyz) both work fine... On Mar 23, 7:30 am, Michael Hwee michael_h...@yahoo.com wrote: There is high important to less important in multiple attributes search. In your case, you have ie.text_field(:index = 2 , :name = q) To us, it means - find text_field with index=2 - comfirm that it also has name='q' So, no wonder you are getting non_existance error if you have other text_fields with no 'q' as name. Correct way is: ie.text_field(:name = q, :index = 2) - Original Message From:Isabeljoybe...@gmail.com To: Watir General watir-general@googlegroups.com Cc: charley.ba...@gmail.com Sent: Sunday, March 22, 2009 10:20:19 PM Subject: [wtr-general] Multiple Attributes for Input Elements Hi, I tried to use the code below to set a value in the text box of the google search page. require 'watir' ie=Watir::IE.new ie.goto http://google.com/; ie.text_field(:index = 2 , :name = q).set(xyz) But I receive an error which is: ruby testmultiAttri.rb c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using {:index=2, :name=q} (Watir::Exception::UnknownObjectException) from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb: 284:in `enabled?' from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb: 56:in `assert_enabled' from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:323:in `set' from testmultiAttri.rb:4 Exit code: 1 Please do let me know where I am going wrong. The text box gets identified correctly if I use any one of the two attributes. Thanks and Regards. On Feb 7, 9:51 pm, Charley Baker charley.ba...@gmail.com wrote: Multiple attributes for input elements are now supported in the latest version of Watir - 1.6.2. The wiki has also been updated. Charley Baker blog:http://charleybakersblog.blogspot.com/ Lead Developer, Watir,http://wtr.rubyforge.org QA Architect, Gap Inc Direct On Fri, Feb 6, 2009 at 11:20 PM, Vens venugopal.devarako...@gmail.comwrote: Hi: I just started using Watir for automating few web UIs. During this I came across a situation where I had to put in data to a text field but incidently there are 2 text boxes having the same name. Please look at the snippet below: div class=boxed h3 class=title Authorize NG IDs /h3 form action=ser.do method=post name=sAFrm input type=hidden value=authorize name=dispatch/ table tbody tr td colspan=2div class=infomark You can enter comma separated multiple ngids /div/td /tr tr th MID /th td select size=1 name=mid/select/td /tr tr th NG IDs /th tdinput type=text value= size=100 maxlength=200 name=ngids//td /tr /tbody /table /form /div div class=boxed h3 class=title Authorize NG IDs /h3 form action=ser.do method=post name=sAFrm input type=hidden value=unauthorize name=dispatch/ table tbody tr td colspan=2div class=infomark You can enter comma separated multiple ngids /div/td /tr tr th MID /th td select size=1 name=mid/select/td /tr tr th NG IDs /th tdinput type=text value= size=100 maxlength=200 name=ngids//td /tr /tbody /table /form /div When I looked into http://wiki.openqa.org/display/WTR/Multiple+Attributesit said it is not implemented for input elements. Can you help me solve this. Regards Venu --~--~-~--~~~---~--~~ 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: Multiple Attributes for Input Elements
actually i am trying to create a framework around watir so by default i get the indices for all the elements and then pass the multiple attributes, so i need to work this out with both the attributes... On Mar 24, 1:38 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Mar 24, 2009 at 09:33, Isabel joybe...@gmail.com wrote: ie.text_field(:name = q ,:index = 2).set(xyz) Still I am getting an error. Because it can not find the second text field with name q. ie.text_field(:name = q ,:index = 1).set(xyz) and ie.text_field(:index = 2).set(xyz) both work fine... I just do not understand the problem. You got it working. What do you want to do? Ž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 -~--~~~~--~~--~--~---
[wtr-general] Multiple Attributes for Input Elements
Hi, I tried to use the code below to set a value in the text box of the google search page. require 'watir' ie=Watir::IE.new ie.goto http://google.com/; ie.text_field(:index = 2 , :name = q).set(xyz) But I receive an error which is: ruby testmultiAttri.rb c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using {:index=2, :name=q} (Watir::Exception::UnknownObjectException) from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb: 284:in `enabled?' from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb: 56:in `assert_enabled' from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:323:in `set' from testmultiAttri.rb:4 Exit code: 1 Please do let me know where I am going wrong. The text box gets identified correctly if I use any one of the two attributes. Thanks and Regards. On Feb 7, 9:51 pm, Charley Baker charley.ba...@gmail.com wrote: Multiple attributes for input elements are now supported in the latest version of Watir - 1.6.2. The wiki has also been updated. Charley Baker blog:http://charleybakersblog.blogspot.com/ Lead Developer, Watir,http://wtr.rubyforge.org QA Architect, Gap Inc Direct On Fri, Feb 6, 2009 at 11:20 PM, Vens venugopal.devarako...@gmail.comwrote: Hi: I just started using Watir for automating few web UIs. During this I came across a situation where I had to put in data to a text field but incidently there are 2 text boxes having the same name. Please look at the snippet below: div class=boxed h3 class=title Authorize NG IDs /h3 form action=ser.do method=post name=sAFrm input type=hidden value=authorize name=dispatch/ table tbody tr td colspan=2div class=infomark You can enter comma separated multiple ngids /div/td /tr tr th MID /th td select size=1 name=mid/select/td /tr tr th NG IDs /th tdinput type=text value= size=100 maxlength=200 name=ngids//td /tr /tbody /table /form /div div class=boxed h3 class=title Authorize NG IDs /h3 form action=ser.do method=post name=sAFrm input type=hidden value=unauthorize name=dispatch/ table tbody tr td colspan=2div class=infomark You can enter comma separated multiple ngids /div/td /tr tr th MID /th td select size=1 name=mid/select/td /tr tr th NG IDs /th tdinput type=text value= size=100 maxlength=200 name=ngids//td /tr /tbody /table /form /div When I looked into http://wiki.openqa.org/display/WTR/Multiple+Attributesit said it is not implemented for input elements. Can you help me solve this. Regards Venu --~--~-~--~~~---~--~~ 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: Access an object
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, :checkbox, :radio, :text_field, :select_list, :button] # Watir elements which elements.each do |el| # iterate over each element element = self.send(el, arg1, arg2) return element if element.exists? # return element if it exists end nil # return nil if element was not found end end Added a few elements more. Now the problem I am facing with this is that when I use it with a select-multiple list, I get an error c:/ruby/lib/ruby/gems/1.8/gems/ watir-1.6.2/lib/watir/input_elements.rb:525:in `method_missing': unknown property or method `checked' (WIN32OLERuntimeError), which means it is taking it as a checkbox. Now if I delete ':checkbox' from the elements array of the function, it takes up the next element instead of taking up ':select_list'. Does the job apparently if I put up ':select_list' before ':checkbox' in the array, still gives me an error c:/ruby/lib/ruby/gems/1.8/gems/ watir-1.6.2/lib/watir/input_elements.rb:68:in `select_item_in_select_list': undefined method `matches' for nil:NilClass (NoMethodError) Please do let me know a possible solution to this. Thanks and Regards, Betsy Joy. On Jan 19, 2:19 pm, Jarmo Pertman jarm...@gmail.com wrote: 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, /blah/) or text_field(:name, blah) or text_field (:xpath, blah) then with xpath it took about 100x+ more time than with other solutions. It has mentioned somewhere else before that Watir builds up DOM and then gets stuff from that with XPath or something. Maybe someone could say about that in little more detail. Anyway, there is my solution for that problem, give it a try and benchmark it against xpath solution if you'd like: Okay. I did something like this. Downside of this implementation is that it iterates through all elements before finding the correct one. So if you'd search for text_field, then first it would search for a button, then for a link and just after that text_field. You can of course change the sequence to be something else and to include some other elements. Also, please bear in mind, that firstelement, which exist with these attributes will be returned. I'd suggest to use b.text_field(:blah, blah) instead of .elementin the future anyway, but I'll provide here one working example: require 'watir' class Watir::IE # monkey-patch Watir's IE class defelement*args arg1, arg2 = args # this is needed so hashes would work as input paremeters as with regular Watir elements = [:button, :link, :text_field] # Watir elements which will be searched elements.each do |el| # iterate over eachelement element= self.send(el, arg1, arg2) returnelementifelement.exists? # returnelementif it exists on page end nil # return nil ifelementwas not found end end b = Watir::IE.new b.goto http://www.google.com; google_text_field = b.element(:name, q) #accesstext_field with two parameters google_button = b.element(:name, btnG) #accessit with two parameters p google_text_field.class # outputs Watir::TextField p google_button.class # outputs Watir::Button google_text_field.value = ruby # type ruby into search string text field google_button.click # and click search puts b.text.include?(Ruby Programming Language) # outputs true # this only works with Watir 1.6.x+ versions puts b.element(:text = Ruby Programming Language, :index = 1).href # multiple attributes, e.g. first link with specified text Best regards, Jarmo --~--~-~--~~~---~--~~ 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] To get the physical description of any Object in a Table cell
I wanted to get the physical description of all the objects (regardless of what they are), in a specified Table cell. The html code is as under:- table id=xyz class=cmbBox border=0 style=height:50px;width: 350px; tr tdinput id=0 type=radio name=List$0 tabindex=2 /label for=0abc/label/td /trtr tdinput id=1 type=checkbox name=List$1 tabindex=2 /label for=1def/label input id=6 type=radio name=List$6 tabindex=2 /label for=6stu/label/td /trtr tdinput id=2 type=checkbox name=List$2 tabindex=2 /label for=2ghi/label/td /trtr tdinput id=3 type=checkbox name=List$3 tabindex=2 /label for=3jkl/label/td /tr /table And the code I am using is-: require 'watir' $ie=Watir::IE.new() $ie.goto(file:///E:\\happy1.htm) puts Number of Tables puts $ie.tables.length $ie.tables.each do |table| table.each do |row| row.each do |cell| a=cell puts Label a.labels.show puts Object puts a.show_all_objects puts\n end end end $ie.close And the result I am getting is :- Number of Tables 1 Label index id namehtmlFor 1 Object ---Objects in page - radio name=List$0 id=0 value=onalt=src= nil Label index id namehtmlFor 1 2 Object ---Objects in page - checkbox name=List$1 id=1 value=onalt=src= radio name=List$6 id=6 value=onalt=src= nil Label index id namehtmlFor 1 Object ---Objects in page - checkbox name=List$2 id=2 value=onalt=src= nil Label index id namehtmlFor 1 Object ---Objects in page - checkbox name=List$3 id=3 value=onalt=src= nil As you can see, I am not able to identify the Attributes (in this case for) for the Label in the Table cell. Please help Thanks in advance :) --~--~-~--~~~---~--~~ 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] To get the physical description of any Object in a Table cell
I wanted to get the physical description of all the objects (regardless of what they are), in a specified Table cell. The html code is as under:- table id=xyz class=cmbBox border=0 style=height:50px;width: 350px; tr tdinput id=0 type=radio name=List$0 tabindex=2 /label for=0abc/label/td /trtr tdinput id=1 type=checkbox name=List$1 tabindex=2 /label for=1def/label input id=6 type=radio name=List$6 tabindex=2 /label for=6stu/label/td /trtr tdinput id=2 type=checkbox name=List$2 tabindex=2 /label for=2ghi/label/td /trtr tdinput id=3 type=checkbox name=List$3 tabindex=2 /label for=3jkl/label/td /tr /table And the code I am using is-: require 'watir' $ie=Watir::IE.new() $ie.goto(file:///E:\\happy1.htm) puts Number of Tables puts $ie.tables.length $ie.tables.each do |table| table.each do |row| row.each do |cell| a=cell puts Label a.labels.show puts Object puts a.show_all_objects puts\n end end end $ie.close And the result I am getting is :- Number of Tables 1 Label index id namehtmlFor 1 Object ---Objects in page - radio name=List$0 id=0 value=onalt=src= nil Label index id namehtmlFor 1 2 Object ---Objects in page - checkbox name=List$1 id=1 value=onalt=src= radio name=List$6 id=6 value=onalt=src= nil Label index id namehtmlFor 1 Object ---Objects in page - checkbox name=List$2 id=2 value=onalt=src= nil Label index id namehtmlFor 1 Object ---Objects in page - checkbox name=List$3 id=3 value=onalt=src= nil As you can see, I am not able to identify the Attributes (in this case for) for the Label in the Table cell. Please help Thanks in advance :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---