[wtr-general] Re: Problem with radio button
Hi Super, I tried with using your code. It didnt give me any error but it did not click on the desired button. Also it did not print any value. Also tell me one thing For this we have to run scripts compulsary in I.E or is it ok to run in FireFox? On Thu, Oct 22, 2009 at 8:31 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Interesting... I'm assuming table matching is the ticket and dynamic variables being the pain... Try this snippet and modify to suit for page require 'watir' require 'watir/ie' require 'watir/dialog' require 'Win32API' ie = Watir::IE.new sURL='http://www.google.com' sURL='C:\Documents and Settings\kpetry\Desktop\t.html' ie.goto(sURL) ie.bring_to_front() myTable=ie.table(:index,1) # loop through the table by indexing the first variable if needed until a match pollText=myTable[1][1].text.upcase #Obvious Text matching here Then invoke this code stream theParse=myTable[1][3].attribute_value(InnerHTML) puts theParse iStart = theParse.rindex('id=')+3 iEnd = theParse.rindex('type=radio')-1 theId= theParse.slice!(iStart..iEnd).strip! puts iStart.to_s puts iEnd.to_s puts theId+'..' ie.radio(:id, theId ).flash ie.radio(:id, theId ).set On Oct 22, 8:31 am, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Thanks a lot.But the name act2[165] is not going to be same all the time. I have my poll title as Test.So i want to set my focus on delete radio button whose title is Test. Is it possible to do this? This is my html script tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td Now here tdTest/td is the title of the poll. So i want to click on delete radio button which has a title named Test :-) On Thu, Oct 22, 2009 at 6:51 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Try something like this where value=delete or update ie.radio(:name,'act2[165]',value).focus ie.radio(:name,'act2[165]'',value).set- 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] Re: Problem with radio button
Hey all, What i have done is: I got all the elements by my_array = Browser.table(:class , 'admin-monochrome').to_a Under my_array i got the string Test. Now how should i click on Delete button? Please help? On Fri, Oct 23, 2009 at 1:55 PM, Amit Kulkarni amitkkulkarni...@gmail.comwrote: Hi Super, I tried with using your code. It didnt give me any error but it did not click on the desired button. Also it did not print any value. Also tell me one thing For this we have to run scripts compulsary in I.E or is it ok to run in FireFox? On Thu, Oct 22, 2009 at 8:31 PM, Super Kevy kpe...@scholarshipamerica.org wrote: Interesting... I'm assuming table matching is the ticket and dynamic variables being the pain... Try this snippet and modify to suit for page require 'watir' require 'watir/ie' require 'watir/dialog' require 'Win32API' ie = Watir::IE.new sURL='http://www.google.com' sURL='C:\Documents and Settings\kpetry\Desktop\t.html' ie.goto(sURL) ie.bring_to_front() myTable=ie.table(:index,1) # loop through the table by indexing the first variable if needed until a match pollText=myTable[1][1].text.upcase #Obvious Text matching here Then invoke this code stream theParse=myTable[1][3].attribute_value(InnerHTML) puts theParse iStart = theParse.rindex('id=')+3 iEnd = theParse.rindex('type=radio')-1 theId= theParse.slice!(iStart..iEnd).strip! puts iStart.to_s puts iEnd.to_s puts theId+'..' ie.radio(:id, theId ).flash ie.radio(:id, theId ).set On Oct 22, 8:31 am, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Thanks a lot.But the name act2[165] is not going to be same all the time. I have my poll title as Test.So i want to set my focus on delete radio button whose title is Test. Is it possible to do this? This is my html script tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td Now here tdTest/td is the title of the poll. So i want to click on delete radio button which has a title named Test :-) On Thu, Oct 22, 2009 at 6:51 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Try something like this where value=delete or update ie.radio(:name,'act2[165]',value).focus ie.radio(:name,'act2[165]'',value).set- 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] Re: Problem with radio button
Well of course it didn't work against your application. You asked to click the delete button in a table row which has 3 columns of content. The above sample had your content in a single rowed table of which only 1 table in the body of the html code. ThusThe samples all point to only a single table index=1 and only one row, where myTable[1][1] represents Row 1 Column 1 and myTable[1][3] represents Row 1 Column 3. If your content is in row seven guess what the index would be. Your last few posts suggests your very much a novice. Please try and incorporate some basic programming logic like a loop to navigate the table structure your interested in. Also use puts to display log messages so you know what happening in your code so you can trace back easily. This is the sample the post checked against it incorporates your snippet to the group. You could change the ID of the radio buttons to anything you want and it would still click the second radio button. html head /head body form id=t1 table tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td /tr tr td width=20% input id=rating[65] type=checkbox value=1 name=rating[65]/ a title=Edit Rating href=/Nikes/ratings/65/edit span class=boldRatingsanity1/span /a /td /tr /table /form /body /hmtl Now lets break down the watir script First open the browser, make it the top window. Next for table of index 1 get the text into pollText from row(1)Col (1)... This would be Test from your sample. Now get the content or row(1)Col(3)... this would have the content of the radio buttons. Update Delete OK I want delete so using (RUBY CLASS STRING) use the rindex (Reverse Index) and parse out the radio button ID that would equate to delete. Now that I know the ID substitute that variable into the radio command... bingo click set flash! Regards... On Oct 23, 3:25 am, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Hi Super, I tried with using your code. It didnt give me any error but it did not click on the desired button. Also it did not print any value. Also tell me one thing For this we have to run scripts compulsary in I.E or is it ok to run in FireFox? On Thu, Oct 22, 2009 at 8:31 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Interesting... I'm assuming table matching is the ticket and dynamic variables being the pain... Try this snippet and modify to suit for page require 'watir' require 'watir/ie' require 'watir/dialog' require 'Win32API' ie = Watir::IE.new sURL='http://www.google.com' sURL='C:\Documents and Settings\kpetry\Desktop\t.html' ie.goto(sURL) ie.bring_to_front() myTable=ie.table(:index,1) # loop through the table by indexing the first variable if needed until a match pollText=myTable[1][1].text.upcase #Obvious Text matching here Then invoke this code stream theParse=myTable[1][3].attribute_value(InnerHTML) puts theParse iStart = theParse.rindex('id=')+3 iEnd = theParse.rindex('type=radio')-1 theId= theParse.slice!(iStart..iEnd).strip! puts iStart.to_s puts iEnd.to_s puts theId+'..' ie.radio(:id, theId ).flash ie.radio(:id, theId ).set On Oct 22, 8:31 am, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Thanks a lot.But the name act2[165] is not going to be same all the time. I have my poll title as Test.So i want to set my focus on delete radio button whose title is Test. Is it possible to do this? This is my html script tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td Now here tdTest/td is the title of the poll. So i want to click on delete radio button which has a title named Test :-) On Thu, Oct 22, 2009 at 6:51 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Try something like this where value=delete or update ie.radio(:name,'act2[165]',value).focus ie.radio(:name,'act2[165]'',value).set- Hide quoted text - - Show quoted text -- 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] Re: Problem with radio button
Help required on above issue :-) 2009/10/21 Amit Kulkarni amitkkulkarni...@gmail.com -- Forwarded message -- From: Amit Kulkarni amitkkulkarni...@gmail.com Date: Wed, Oct 21, 2009 at 4:40 PM Subject: Re: [wtr-general] Re: Problem with radio button To: watir-general@googlegroups.com No it does not flashed the radio button but again it is popping the window. I dont know why it is getting popped up. Any suggestions?? On Wed, Oct 21, 2009 at 4:25 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Oct 21, 2009 at 12:51 PM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: It pops up a small window saying Please select an operation along with OK button. Is the correct radio button flashed if you do this? browser.radio(:after?, browser.cell(:text, Test)).flash Maybe you have to fire some javascript event. Ž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] Re: Problem with radio button
Try something like this where value=delete or update ie.radio(:name,'act2[165]',value).focus ie.radio(:name,'act2[165]'',value).set --~--~-~--~~~---~--~~ 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: Problem with radio button
Thanks a lot.But the name act2[165] is not going to be same all the time. I have my poll title as Test.So i want to set my focus on delete radio button whose title is Test. Is it possible to do this? This is my html script tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td Now here tdTest/td is the title of the poll. So i want to click on delete radio button which has a title named Test :-) On Thu, Oct 22, 2009 at 6:51 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Try something like this where value=delete or update ie.radio(:name,'act2[165]',value).focus ie.radio(:name,'act2[165]'',value).set --~--~-~--~~~---~--~~ 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: Problem with radio button
Interesting... I'm assuming table matching is the ticket and dynamic variables being the pain... Try this snippet and modify to suit for page require 'watir' require 'watir/ie' require 'watir/dialog' require 'Win32API' ie = Watir::IE.new sURL='http://www.google.com' sURL='C:\Documents and Settings\kpetry\Desktop\t.html' ie.goto(sURL) ie.bring_to_front() myTable=ie.table(:index,1) # loop through the table by indexing the first variable if needed until a match pollText=myTable[1][1].text.upcase #Obvious Text matching here Then invoke this code stream theParse=myTable[1][3].attribute_value(InnerHTML) puts theParse iStart = theParse.rindex('id=')+3 iEnd = theParse.rindex('type=radio')-1 theId= theParse.slice!(iStart..iEnd).strip! puts iStart.to_s puts iEnd.to_s puts theId+'..' ie.radio(:id, theId ).flash ie.radio(:id, theId ).set On Oct 22, 8:31 am, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Thanks a lot.But the name act2[165] is not going to be same all the time. I have my poll title as Test.So i want to set my focus on delete radio button whose title is Test. Is it possible to do this? This is my html script tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td Now here tdTest/td is the title of the poll. So i want to click on delete radio button which has a title named Test :-) On Thu, Oct 22, 2009 at 6:51 PM, Super Kevy kpe...@scholarshipamerica.orgwrote: Try something like this where value=delete or update ie.radio(:name,'act2[165]',value).focus ie.radio(:name,'act2[165]'',value).set- 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] Re: Problem with radio button
On Wed, Oct 21, 2009 at 9:26 AM, Amit amitkkulkarni...@gmail.com wrote: Now here i want to click on Delete radio button beside Test poll. Can you post html that includes radio button and Test text? We could help more if we had that. input id=act2_165_delete type=radio value=delete name=act2 [165]/ I think you said you do not know id, but if you know it, this should work: browser.radio(:id, act2_165_delete).set More information: http://wiki.openqa.org/display/WTR/Radio+Buttons Ž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: Problem with radio button
tr tdTest/td tdUnpublished/td td class=actions label for=Update input id=act2_165_update type=radio value=update name=act2 [165]/ Update /label label for=del2 input id=act2_165_delete type=radio value=delete name=act2 [165]/ Delete /label /td This is html which contains the string Test. Yes i can access through an id.But it is not going to be same all the time.It is always going to be changed. But one thing i know is that my poll title i.e. Test.So i want to access the radio button which contains the title Test. GUI appearance is as follows: POLLStatus Actions TestUnpublished Here contains 2 radio buttons i.e. Update and Delete On Oct 21, 1:19 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Oct 21, 2009 at 9:26 AM, Amit amitkkulkarni...@gmail.com wrote: Now here i want to click on Delete radio button beside Test poll. Can you post html that includes radio button and Test text? We could help more if we had that. input id=act2_165_delete type=radio value=delete name=act2 [165]/ I think you said you do not know id, but if you know it, this should work: browser.radio(:id, act2_165_delete).set More information: http://wiki.openqa.org/display/WTR/Radio+Buttons Ž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: Problem with radio button
On Wed, Oct 21, 2009 at 10:35 AM, Amit amitkkulkarni...@gmail.com wrote: tdTest/td input type=radio / Does this work? browser.button(:after?, browser.cell(:text, Test)).set Ž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] Re: Problem with radio button
On Wed, Oct 21, 2009 at 10:50 AM, Željko Filipin zeljko.fili...@wa-research.ch wrote: browser.button(:after?, browser.cell(:text, Test)).set My mistake. Try this: browser.radio(:after?, browser.cell(:text, Test)).click If that does not work, you can always try xpath: http://wiki.openqa.org/display/WTR/XPath Ž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] Re: Problem with radio button
Hi Zeljko, I tried by using the above step but still no success :-( It pops up a small window saying Please select an operation along with OK button. I still cant figure out whats is the problem. On Wed, Oct 21, 2009 at 4:04 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Oct 21, 2009 at 10:50 AM, Željko Filipin zeljko.fili...@wa-research.ch wrote: browser.button(:after?, browser.cell(:text, Test)).set My mistake. Try this: browser.radio(:after?, browser.cell(:text, Test)).click If that does not work, you can always try xpath: http://wiki.openqa.org/display/WTR/XPath Ž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] Re: Problem with radio button
On Wed, Oct 21, 2009 at 12:51 PM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: It pops up a small window saying Please select an operation along with OK button. Is the correct radio button flashed if you do this? browser.radio(:after?, browser.cell(:text, Test)).flash Maybe you have to fire some javascript event. Ž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] Re: Problem with radio button
No it does not flashed the radio button but again it is popping the window. I dont know why it is getting popped up. On Wed, Oct 21, 2009 at 4:25 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Oct 21, 2009 at 12:51 PM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: It pops up a small window saying Please select an operation along with OK button. Is the correct radio button flashed if you do this? browser.radio(:after?, browser.cell(:text, Test)).flash Maybe you have to fire some javascript event. Ž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 -~--~~~~--~~--~--~---
Fwd: [wtr-general] Re: Problem with radio button
-- Forwarded message -- From: Amit Kulkarni amitkkulkarni...@gmail.com Date: Wed, Oct 21, 2009 at 4:40 PM Subject: Re: [wtr-general] Re: Problem with radio button To: watir-general@googlegroups.com No it does not flashed the radio button but again it is popping the window. I dont know why it is getting popped up. Any suggestions?? On Wed, Oct 21, 2009 at 4:25 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Oct 21, 2009 at 12:51 PM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: It pops up a small window saying Please select an operation along with OK button. Is the correct radio button flashed if you do this? browser.radio(:after?, browser.cell(:text, Test)).flash Maybe you have to fire some javascript event. Ž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 -~--~~~~--~~--~--~---