require 'watir' test_site = 'http://newpmr2prod.jpmorgan.com/PM/PMlogin.do' b = Watir::Browser.new username='sudhikumar' pwd='jpm' level='level0' bu='00907' b.goto(test_site) b.text_field(:name, 'userID').set(username) b.text_field(:name, 'password').set(pwd) b.form(:action, '/PM/PMlogin.do').submit b.frame(:name, 'menuMiddle').link(:text, 'Performance').click b.frame(:name, 'rightFrame2').select_list(:name,level).set(bu) => false => "http://newpmr2prod.jpmorgan.com/PM/PMlogin.do" => #<Watir::IE:0xc752478 url="about:blank" title=""> => "sudhikumar" => "jpm" => "level0" => "00907" => 6.37 => "" => "" => 5.137 => 1.468 Watir::Exception::UnknownObjectException: Unable to locate element, using :name, "level0" from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: 56:in `assert_exists' from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ input_elements.rb:62:in `select_item_in_select_list' from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ input_elements.rb:46:in `set' from (irb):136 from :0
<!----> <html> <head> <title>JPM PM system</title> <base href="http://newpmr2prod.jpmorgan.com:80/PM/"> <script language='javascript'> history.go(1); </script> <script language="javascript" src="./includes/common/TimerDiv.js"></ script> <link rel="stylesheet" href="./stylesheet.css" type="text/css"> <script language="javascript" src="./includes/common/lib_func.js"></ script> <script language="javascript" src="./includes/common/common.js"></ script> <script language="javascript" src="./includes/common/ lib_submitfrm.js"></script> <script language="javascript" src="./includes/reporttemplate/perf/ perftemplateview.js"></script> <script language="javascript"> var isTemplateAvbl = false; function submitReportTypes(mode){ var selectIndex = document.forms[0].selectedReportDetailsString.selectedIndex; parent.rightFrame2.document.forms[0].reportDetailsString.value=parent.rightFrame2.document.forms[0].selectedReportDetailsString.options[selectIndex].value; parent.rightFrame2.document.forms[0].operation.value="ReportTemplate_Reportselect"; parent.rightFrame2.document.forms[0].submit(); } function changetext(whichcontent,i){ if (document.all||document.getElementById){ desc = "descriptions"+i; var cross_el=document.getElementById? document.getElementById(desc):eval("document.all."+desc); cross_el.style.visibility = "visible"; } else if (document.layers){ desc1 = "a"+i; obj1 = eval("document."+desc1); obj1.visibility = "visible"; } } function hidetext(i){ if (document.all||document.getElementById){ desc = "descriptions"+i; var cross_el=document.getElementById? document.getElementById(desc):eval("document.all."+desc); cross_el.style.visibility="hidden"; }else{ desc1 = "a"+i; obj1 = eval("document."+desc1); obj1.visibility = "hidden"; } } function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW ) location.reload(); } MM_reloadPage(true); // --> function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i+ +) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function MM_showHideLayers() { //v3.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))! =null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible': (v='hide')?'hidden':v; } obj.visibility=v; } } </script> </head> <body class="FormBackground" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <form name="ReportTemplateListBean" method="POST" action="/PM/ perfreporttemplate.do"> <input type="hidden" name="selectedLevel" value="0"> <input type="hidden" name="dimensionVOString" value=""> <input type="hidden" name="reportDetailsString" value=""> <input type="hidden" name="reportType" value=""> <input type="hidden" name="currentUser" value="sudhikumar"> <input type="hidden" name="PERF_BY_DIM" value="Performance by Dimension"> <input type="hidden" name="buMigStatus" value=""> <input type="hidden" name="reportMode" value=""> <input type="hidden" name="roleId" value="PS"> <script language="javascript"> parent.rightFrame1.location.href="./perfreporttemplateButton.do"; </script> <center> </center> <center> </center> <br> <table class="innertablewidth" border ="0" cellspacing="0" cellpadding="0" width="100%"> <input type="hidden" name="operation" value=""> <tr align="left"> <td class="label" colspan="2"> Business Unit<font face="verdana,arial,helvetica" size="1" color="#FF0000"></font> </td> </tr> <tr align="left"> <td class="label" width="18.5%" > Level One<font face="verdana,arial,helvetica" size="1" color="#FF0000">*</font> </td> <td align="left" width="81.5%"> <font face="verdana,arial,helvetica" size="2" color="#FF0000"> <select name="level0" width="300" onchange="javascript:selectcombo_Report('0','ReportTemplate_Buselect',this.form)" class="select-menut"><option value="-1" selected="selected">- Select One -</option> <option value="DEMO-00908">ABC Company</option> <option value="DEMO-UK016">ABC-GBP</option> <option value="00901">ABPorts</option> <option value="ABSCOMBINED">ABS Combined</option> <option value="BU5514">ADP DC and DB Plans</option> <option value="03354">Advance Publications</option> <option value="04252">Alcon Laboratories</option> <option value="04253">Alcon-Puerto Rico Active Balanced Fund</option> <option value="03031">Allen and Company</option> I have given the details and still I am unable to select from selectlist Thanks for your help On Aug 17, 6:43 am, Pallavi Sharma <write2pall...@gmail.com> wrote: > Hi Sudhir > > Chuck is right in here stating the same, i am just trying here to identify > hat after you login you get frames in your application, just make sure if > your select list is in a frame you give the right object identification, and > another thing, if the select list is identified as an object than like Chuck > stated, there must be an event which has to be fired so that you are able to > select the element in the list, if just .select is not working. > > require 'watir' > begin > > test_site = 'http://newpmr2prod.jpmorgan.com/PM/PMlogin.do' > b = Watir::Browser.new > b.goto(test_site) > b.text_field(:name, "userID").set("sudhikumar") > b.text_field(:name, "password").set("jpm") > b.form(:action, "/PM/PMlogin.do").submit > b.show_frames > b.frame(:name, "menuMiddle").link(:text, "Performance").click > if b.select_list(:name, 'level0').exists? then > puts "true" > b.select_list(:name, 'level0').select ("00990") > end > rescue Exception => ex > puts ex.message > end > > Whats your out put in here? Is it possible to give a session like using team > viewer or web ex, to see whats happening in there... if not allowed to > access the site? > > Regards > Pallavi. > > On Tue, Aug 17, 2010 at 4:37 AM, Chuck van der Linden <sqa...@gmail.com>wrote: > > > It doesn't make any sense that a change later in the script would > > cause a problem with logging in, unless perhaps you had not logged out > > the prior user, it was the same browser session, and an active session > > still existed?, or there were cookies or some other means by which an > > active session was persisted? For tests like this I'd always make > > sure the user is logged out, before you try to run the script. > > > The selection list looks pretty much like a normal select list other > > than having a javascript onchange event in there. So I'd try > > addressing it like a normal selection list, but I'd also after > > using .select to pick an option by name, I'd add a command to fire > > the onchange method on the select_list element, which should give the > > javascript a chance to do it's stuff. > > > On Aug 16, 6:04 am, sudhir <prem...@gmail.com> wrote: > > > require 'watir' > > > begin > > > test_site = 'http://newpmr2prod.jpmorgan.com/PM/PMlogin.do' > > > b = Watir::Browser.new > > > > b.goto(test_site) > > > b.text_field(:name, "userID").set("sudhikumar") > > > b.text_field(:name, "password").set("jpm") > > > b.form(:action, "/PM/PMlogin.do").submit > > > #b.show_frames() > > > b.frame(:name, "menuMiddle").link(:text, "Performance").click > > > #b.select_list(:name, 'level0').select ("00990") > > > rescue Exception => ex > > > > end > > > => false > > > => 2.172 > > > irb(main):087:0> require 'watir' > > > begin > > > test_site = 'http://newpmr2prod.jpmorgan.com/PM/PMlogin.do' > > > b = Watir::Browser.new > > > > b.goto(test_site) > > > b.text_field(:name, "userID").set("sudhikumar") > > > b.text_field(:name, "password").set("jpm") > > > b.form(:action, "/PM/PMlogin.do").submit > > > #b.show_frames() > > > b.frame(:name, "menuMiddle").link(:text, "Performance").click > > > b.select_list(:name, 'level0').select ("00990") > > > rescue Exception => ex > > > > end > > > => false > > > Errno::EBADF: Bad file descriptor > > > from (irb):98:in `write' > > > > See the two execution....First one able to login > > > but with b.show_frames() not able to login > > > > On Aug 16, 5:23 pm, Pallavi Sharma <write2pall...@gmail.com> wrote: > > > > > Sudhir > > > > > Do this: > > > > > require 'watir' > > > > begin > > > > test_site = '.............' > > > > b = Watir::Browser.new > > > > b.goto(test_site) > > > > b.text_field(:name, "userID").set("sudhikumar") > > > > b.text_field(:name, "password").set("jpm") > > > > b.form(:action, "/PM/PMlogin.do").submit > > > > b.show_frames() ##TO GET THE NAME OF THE FRAMES## > > > > > b.frame(:name, "menuMiddle").link(:text, "Performance").click > > > > #b.select_list(:name, 'level0').select ("00990") > > > > rescue Exception => ex > > > > puts ex.message > > > > end > > > > > Is it possible that the select list you are trying to access is also in > > a > > > > frame?? > > > > > Regards > > > > Pallavi > > > > > 2010/8/16 Pallavi Sharma <write2pall...@gmail.com> > > > > > > Sudhir > > > > > > Do this: > > > > > > require 'watir' > > > > > begin > > > > > test_site = '.............' > > > > > b = Watir::Browser.new > > > > > > b.goto(test_site) > > > > > b.text_field(:name, "userID").set("sudhikumar") > > > > > b.text_field(:name, "password").set("jpm") > > > > > b.form(:action, "/PM/PMlogin.do").submit > > > > > b.show_frames() > > > > > > b.frame(:name, "menuMiddle").link(:text, "Performance").click > > > > > #b.select_list(:name, 'level0').select ("00990") > > > > > rescue Exception => ex > > > > > > end > > > > > > 2010/8/16 sudhir <prem...@gmail.com> > > > > > >> require 'watir' > > > > > >> test_site = '.............' > > > > > >> b = Watir::Browser.new > > > > > >> b.goto(test_site) > > > > >> b.text_field(:name, "userID").set("sudhikumar") > > > > >> b.text_field(:name, "password").set("jpm") > > > > >> b.form(:action, "/PM/PMlogin.do").submit > > > > >> b.frame(:name, "menuMiddle").link(:text, "Performance").click > > > > > >> Instead of exception I am able to login with above userid and pwd > > and > > > > >> upto "Performance" click > > > > > >> On Aug 16, 2:40 pm, Pallavi Sharma <write2pall...@gmail.com> wrote: > > > > >> > No Sudhir > > > > > >> > You are getting this exception for all objects in your > > application. > > > > >> remove > > > > >> > all code and just try the setting user id, > > > > > >> > Does your application has frames...? > > > > > >> > Regards > > > > >> > Pallavi. > > > > > >> > On Mon, Aug 16, 2010 at 2:42 PM, sudhir <prem...@gmail.com> > > wrote: > > > > >> > > require 'watir' > > > > >> > > test_site = '.............' > > > > > >> > > b = Watir::Browser.new > > > > > >> > > b.goto(test_site) > > > > >> > > b.text_field(:name, "userID").set("sudhikumar") > > > > >> > > b.text_field(:name, "password").set("jpm") > > > > >> > > b.form(:action, "/PM/PMlogin.do").submit > > > > >> > > b.frame(:name, "menuMiddle").link(:text, "Performance").click > > > > >> > > b.select_list(:name, 'level0').select ("00990") > > > b.select_list(:name,'selectedReportDetailsString').select("SecurityPerforma > > nce##4## > > > > >> > > ## || ##RPTTYP##PERF|| ||") > > > > >> > > => false > > > > >> > > => "http://newpmr2prod.jpmorgan.com/PM/PMlogin.do" > > > > >> > > => #<Watir::IE:0xdc87230 url="about:blank" title=""> > > > > >> > > => 5.391 > > > > >> > > Watir::Exception::UnknownObjectException: Unable to locate > > element, > > > > >> > > using :name, "userID" > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 56:in `assert_exists' > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 288:in `enabled?' > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 60:in `assert_enabled' > > > > >> > > from > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ > > > > >> > > input_elements.rb:327:in `set' > > > > >> > > from (irb):27 > > > > >> > > from :0 > > > > >> > > Watir::Exception::UnknownObjectException: Unable to locate > > element, > > > > >> > > using :name, "password" > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 56:in `assert_exists' > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 288:in `enabled?' > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 60:in `assert_enabled' > > > > >> > > from > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ > > > > >> > > input_elements.rb:327:in `set' > > > > >> > > from (irb):28 > > > > >> > > from :0 > > > > >> > > Watir::Exception::UnknownFormException: Unable to locate a form > > using > > > > >> > > action and /PM/PMlogin.do > > > > >> > > from > > > > >> C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/form.rb: > > > > >> > > 79:in `assert_exists' > > > > >> > > from > > > > >> C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/form.rb: > > > > >> > > 86:in `submit' > > > > >> > > from (irb):29 > > > > >> > > from :0 > > > > >> > > => 1.734 > > > > >> > > Errno::EBADF: Bad file descriptor > > > > >> > > from (irb):31:in `write' > > > > >> > > Watir::Exception::UnknownObjectException: Unable to locate > > element, > > > > >> > > using :name, "selectedReportDetailsString" > > > > >> > > from > > > > >> > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb: > > > > >> > > 56:in `assert_exists' > > > > >> > > from > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ > > > > >> > > input_elements.rb:62:in `select_item_in_select_list' > > > > >> > > from > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ > > > > >> > > input_elements.rb:46:in `select' > > > > >> > > from (irb):32 > > > > >> > > from :0 > > > > > >> > > I am getting the above error while selecting from the > > > > >> > > dropbox........... > > > > >> > > Let me know if you require more deatils. > > > > >> > > The website I want to automate is not public....... > > > > > >> > > On Aug 16, 11:18 am, Pallavi Sharma <write2pall...@gmail.com> > > wrote: > > > > >> > > > Sudhir > > > > > >> > > > ie.select_list(:name, 'level0').select ("ITEM you want to > > select") > > > > > >> > > > Regards > > > > > >> > > > Pallavi > > > > > >> > > > 2010/8/16 sudhir <prem...@gmail.com> > > > > > >> > > > > Pallavi, > > > > >> > > > > The select list for ABPorts is given below: > > > > >> > > > > <select name="level0" width="300" > > > onchange="javascript:selectcombo_Report('0','ReportTemplate_Buselect',this. > > form)" > > > > >> > > > > class="select-menut"><option value="-1" > > selected="selected">- > > > > >> Select > > > > >> > > > > One -</option> > > > > >> > > > > <option value="DEMO-00908">ABC Company</option> > > ... > > read more » -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com